Last active
March 16, 2016 13:21
-
-
Save wirwolf/300732fbadfc7815ebef to your computer and use it in GitHub Desktop.
nginx config(angular app + yii2)
This file contains 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
#frontend | |
server { | |
listen 80; | |
server_name admin.host.com; | |
server_tokens off; | |
client_max_body_size 8M; | |
charset utf-8; | |
access_log /home/www-data/admin.host.com/logs/frontend-access.log; | |
error_log /home/www-data/admin.host.com/logs/frontend-error.log; | |
root /home/www-data/admin.host.com/www/app/dist; | |
index index.html; | |
location / { | |
try_files $uri $uri/ /index.html?$args; | |
} | |
location /src/ { | |
allow 176.105.103.83; #office ip | |
deny all; | |
autoindex on; | |
root /home/www-data/admin.host.com/www/app; | |
#try_files $uri $uri/ /index.html?$args; | |
} | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
log_not_found off; | |
access_log off; | |
} | |
location ~ /\. { | |
deny all; | |
access_log off; | |
log_not_found off; | |
} | |
} | |
# backend | |
server { | |
listen 8080; | |
server_name admin.host.com; | |
server_tokens off; | |
client_max_body_size 8M; | |
charset utf-8; | |
access_log /home/www-data/admin.host.com/logs/backend-access.log; | |
error_log /home/www-data/admin.host.com/logs/backend-error.log; | |
root /home/www-data/admin.host.com/www/server/web; | |
index index.php; | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_index index.php; | |
# Connect to php-fpm via socket | |
fastcgi_pass unix:/run/php5-fpm.sock; | |
fastcgi_connect_timeout 30s; | |
fastcgi_read_timeout 30s; | |
fastcgi_send_timeout 60s; | |
fastcgi_ignore_client_abort on; | |
fastcgi_pass_header "X-Accel-Expires"; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
fastcgi_param HTTP_REFERER $http_referer; | |
include fastcgi_params; | |
} | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
log_not_found off; | |
access_log off; | |
} | |
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