Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- geo $maintenance {
- default yes;
- 192.168.1.2 no;
- }
- server {
- listen 80;
- server_name domain.ru;
- root /var/www/domain;
- index index.php index.html index.htm;
- location / {
- if (-f /etc/nginx/maintenance.file) {
- set $tmp clo;
- }
- if ($maintenance = yes) {
- set $action "${tmp}se";
- }
- if ($action = close) {
- return 503;
- }
- try_files $uri $uri/ /index.php?q=$uri&$args;
- }
- error_page 404 /404.html;
- error_page 500 502 504 /50x.html;
- location = /50x.html {
- root /var/www/domain;
- }
- error_page 503 /503.html;
- location = /503.html {
- root /var/www/domain/error/;
- }
- location ~ \.php$ {
- try_files $uri =404;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment