Тема: Не работают виртуальные хосты в nginx freebsd
Здравствуйте! Поднял на FreeBSD NGinx + php-fpm, все работает, кроме виртуальных хостов. По домену виртуального хоста вместо открытия нужной директории, открывает директорию для стандартного сайта.
Конфиги:
Стандартный:
cat /usr/local/etc/nginx/nginx.conf
user www;
worker_processes 2;
pid /var/run/nginx.pid;
error_log /var/log/nginx/nginx-error.log warn;
events {
worker_connections 1024;
use kqueue;
}
http {
include mime.types;
default_type application/octet-stream;
# log options
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
# nginx options
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_tokens off;
# fastcgi
fastcgi_intercept_errors on;
# virtual hosting
include /usr/local/etc/nginx/vhosts/*;
# virtual server
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/nginx-access.log main;
# server root directory
location / {
root /usr/local/www/apache22/data/;
index index.php index.html index.htm;
}
location ~* /(var|lib|application)/.*$ {
return 403;
}
location ~* \.ini$ {
return 403;
}
location ~ \.php$ {
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/apache22/data/$fastcgi_script_name;
include fastcgi_params;
}
}
}
И для виртуального хоста :
# virtual server
server {
listen 80;
server_name domain.com www.domain.com;
access_log /var/log/nginx/domain.com-access.log main;
# server root directory
location / {
root /usr/local/www/apache22/data/domain1;
index index.php index.html index.htm;
}
location ~* /(var|lib|application)/.*$ {
return 403;
}
location ~* \.ini$ {
return 403;
}
# php
location ~ \.php$ {
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}