Files
structure/config/nginx/conf.d/z-yii.conf.example

42 lines
1.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

server {
server_name
yii.local.slave.dimti.ru
backend.yii.local.slave.dimti.ru
;
root $root;
set $yii_bootstrap "index.php";
charset utf-8;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
}
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
# отключаем обработку запросов фреймворком к несуществующим статичным файлам
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
# передаем PHP-скрипт серверу FastCGI, прослушивающему адрес 127.0.0.1:9000
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
# позволяем yii перехватывать запросы к несуществующим PHP-файлам
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
fastcgi_pass fpm74;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
# PATH_INFO и PATH_TRANSLATED могут быть опущены, но стандарт RFC 3875 определяет для CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
# не позволять nginx отдавать файлы, начинающиеся с точки (.htaccess, .svn, .git и прочие)
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}