Created
November 2, 2015 15:31
-
-
Save edtoken/47400d4b3ce323691791 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
listen 443 ssl; | |
ssl_certificate /etc/nginx/ssl/server.crt; | |
ssl_certificate_key /etc/nginx/ssl/server.key; | |
set $host_path "/var/lib/jenkins/jobs/{PROJECT_NAME}/workspace/web/{SERVER}"; | |
access_log /var/lib/jenkins/jobs/{PROJECT_NAME}/workspace/runtime/logs/access.log; | |
error_log /var/lib/jenkins/jobs/{PROJECT_NAME}/workspace/runtime/logs/error.log; | |
server_name {DOMAIN_NAME}; | |
root $host_path; | |
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 127.0.0.1:9000; | |
#fastcgi_pass /var/run/php5-fpm.sock; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_read_timeout 6000; | |
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment