Guest User

myNgnxRules

a guest
Jul 9th, 2012
66
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. server {
  2. listen *:80;
  3. server_name .map.by;
  4. access_log /var/log/nginx/access.log;
  5.  
  6. root /home/mapby/www/web;
  7. index index.php index.html index.htm;
  8.  
  9. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9090
  10. #
  11.  
  12. if ($host = 'gomel.map.by' ) {
  13. rewrite ^/(.*)$ http://map.by/%D0%93%D0%BE%D0%BC%D0%B5%D0%BB%D1%8C$1 permanent;
  14. }
  15.  
  16.  
  17. location / {
  18. rewrite "^/minsk_anons/[0-9]{2,4}[0-9]{1,2}[0-9]{1,2}_([0-9]+)\.html$" /834a74fe95a05a05a95d7cfaec9cc494.php;
  19. rewrite ^/news/(.*)\.htm$ /news/$1.html redirect;
  20. index index.php;
  21. try_files $uri /index.php?$args;
  22.  
  23. }
  24.  
  25. location /js {
  26. gzip on;
  27. gzip_http_version 1.1;
  28. gzip_vary on;
  29. gzip_comp_level 6;
  30. gzip_proxied any;
  31. gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
  32.  
  33. # make sure gzip does not lose large gzipped js or css files
  34. # see http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl
  35. gzip_buffers 16 8k;
  36.  
  37. # Disable gzip for certain browsers.
  38. gzip_disable "MSIE [1-6].(?!.*SV1)";
  39. }
  40.  
  41. location /css {
  42. gzip on;
  43. gzip_http_version 1.1;
  44. gzip_vary on;
  45. gzip_comp_level 6;
  46. gzip_proxied any;
  47. gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
  48.  
  49. # make sure gzip does not lose large gzipped js or css files
  50. # see http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl
  51. gzip_buffers 16 8k;
  52.  
  53. # Disable gzip for certain browsers.
  54. gzip_disable "MSIE [1-6].(?!.*SV1)";
  55. }
  56.  
  57. location ^~ /backend.php {
  58. include fastcgi_params;
  59. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  60. fastcgi_param PATH_INFO $fastcgi_path_info;
  61. fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
  62. fastcgi_index index.php;
  63. fastcgi_param SCRIPT_FILENAME /home/mapby/www/web$fastcgi_script_name;
  64. fastcgi_param HTTPS off;
  65. fastcgi_pass 127.0.0.1:9000;
  66.  
  67. fastcgi_cache off;
  68. try_files $uri /backend.php?$args;
  69. }
  70.  
  71. location ~ \.php$ {
  72. include fastcgi_params;
  73. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  74. fastcgi_param PATH_INFO $fastcgi_path_info;
  75. fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
  76. fastcgi_index index.php;
  77. fastcgi_param SCRIPT_FILENAME /home/mapby/www/web$fastcgi_script_name;
  78. fastcgi_param HTTPS off;
  79. fastcgi_pass 127.0.0.1:9000;
  80.  
  81. fastcgi_pass_header "Set-Cookie";
  82. fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
  83. fastcgi_cache_key "$server_addr:$server_port$request_uri|$cookie_phpsessid|$cookie_symfony|$cookie_OAID";
  84. fastcgi_cache fastcgi_cache;
  85. fastcgi_temp_path /var/cache/nginx/ 1 2;
  86. fastcgi_cache_use_stale updating error timeout invalid_header http_500;
  87. fastcgi_cache_valid 120s;
  88. }
  89.  
  90.  
  91. location ^~ /frontend_dev.php/ {
  92. try_files $uri /frontend_dev.php?$args;
  93. }
  94.  
  95.  
  96. location ^~ /cabinet.php/ {
  97. try_files $uri /cabinet.php?$args;
  98. }
  99.  
  100. location ^~ /cabinet_dev.php/ {
  101. try_files $uri /cabinet_dev.php?$args;
  102. }
  103.  
  104. }
RAW Paste Data