Guest User

nginx

a guest
Jun 9th, 2014
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. geo $maintenance {
  2. default yes;
  3. 192.168.1.2 no;
  4. }
  5.  
  6. server {
  7. listen 80;
  8. server_name domain.ru;
  9.  
  10. root /var/www/domain;
  11. index index.php index.html index.htm;
  12.  
  13. location / {
  14. if (-f /etc/nginx/maintenance.file) {
  15. set $tmp clo;
  16. }
  17. if ($maintenance = yes) {
  18. set $action "${tmp}se";
  19. }
  20. if ($action = close) {
  21. return 503;
  22. }
  23.  
  24. try_files $uri $uri/ /index.php?q=$uri&$args;
  25. }
  26.  
  27. error_page 404 /404.html;
  28.  
  29. error_page 500 502 504 /50x.html;
  30. location = /50x.html {
  31. root /var/www/domain;
  32. }
  33.  
  34. error_page 503 /503.html;
  35. location = /503.html {
  36. root /var/www/domain/error/;
  37. }
  38.  
  39. location ~ \.php$ {
  40. try_files $uri =404;
  41. fastcgi_pass unix:/var/run/php5-fpm.sock;
  42. fastcgi_index index.php;
  43. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  44. include fastcgi_params;
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment