server {
set $yii_bootstrap "index.php";
charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name test.site.ru;
root /var/www/site.ru/test/frontend/web;
index $yii_bootstrap;
access_log /var/www/site.ru/logs/test.site.access.log main;
error_log /var/www/site.ru/logs/test.site.error.log;
location /admin {
try_files $uri $uri/ /$yii_bootstrap?$args;
root /var/www/site.ru/test/backend/web;
}
location / {
try_files $uri $uri/ /$yii_bootstrap?$args;
}
# uncomment to avoid processing of calls to unexisting ystatic files by yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~ /\.(ht|svn|git) {
deny all;
}
}
server {
listen 80;
server_name example.ru;
root /home/example/data/www/example.ru;
index index.html index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$args;
}
location /admin {
try_files $uri $uri/ /admin.php?$args;
}
location ~ \.php$ {
root /home/example/data/www/example.ru;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/example/data/www/example.ru$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}