Guest User

Untitled

a guest
Nov 25th, 2011
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # search for already compressed files
  2. gzip_static on;
  3. gzip on;
  4.  
  5. # some images have no mime type
  6. default_type image/jpeg;
  7.  
  8. # 404 generated from php can be rather slow. Uncomment with care
  9. error_page 404 /index.php;
  10.  
  11. # disallow access to version control directory, but return 404, not to disclose information
  12. location /.git {
  13. return 404;
  14. }
  15.  
  16. # robots.txt is important for search engines
  17. location /robots.txt {
  18. access_log off;
  19. }
  20.  
  21. # This is mostly based on Drupal's stock .htaccess
  22. location ~* ^.+(\.(txt|engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
  23. return 404;
  24. }
  25.  
  26. # serve imagecache files directly or redirect to drupal if they do not exist
  27. location ~* imagecache {
  28. access_log off;
  29. expires 30d;
  30. try_files $uri @drupal;
  31. }
  32.  
  33. # Drupal 7 image stylef
  34. location ~* image/generate {
  35. access_log off;
  36. expires 30d;
  37. try_files $uri @drupal;
  38. }
  39.  
  40. # serve static files directly
  41. location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|swf|flv)$ {
  42. access_log off;
  43. log_not_found off;
  44. expires 30d;
  45. }
  46.  
  47. location @rewrite {
  48. # Some modules enforce no slash (/) at the end of the URL
  49. # Else this rewrite block wouldn't be needed (GlobalRedirect)
  50. rewrite ^/(.*)$ /index.php?q=$1;
  51. break;
  52. }
  53.  
  54. # This rewrites pages to be sent to PHP processing
  55. location @drupal {
  56. rewrite ^/(.*)$ /index.php?q=$1 last;
  57.  
  58. }
  59.  
  60. location / {
  61. try_files $uri @cache;
  62. }
  63.  
  64. # This will try to see if we have a boost file in place. no harm done if this is not used
  65. location @cache {
  66. # queries, drupal cookies, or not GET methods, all require PHP processing.
  67. if ($query_string ~ ".+") {
  68. return 405;
  69. }
  70. if ($http_cookie ~ "DRUPAL_UID" ) {
  71. return 405;
  72. }
  73. if ($request_method !~ ^(GET|HEAD)$ ) {
  74. return 405;
  75. }
  76. error_page 405 = @drupal;
  77.  
  78. # Drupal uses 1978 - I am 4 years older than Dries :)
  79. add_header Expires "Tue, 22 Sep 1974 08:00:00 GMT";
  80. add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
  81. try_files /cache/normal/$host/${uri}_.html /cache/mobile/$host/${uri}_.html /cache/perm/$host/${uri}_.css /cache/perm/$host/${uri}_.js /cache/$host/0$uri.html /cache/$host/0${uri}/index.html @drupal;
  82. }
  83.  
  84.  
  85. location /phpmyadmin {
  86. root /usr/share/;
  87. index index.php index.html index.htm;
  88. location ~ ^/phpmyadmin/(.+\.php)$ {
  89. try_files $uri =404;
  90. root /usr/share/;
  91. fastcgi_pass 127.0.0.1:9000;
  92. fastcgi_index index.php;
  93. fastcgi_param SCRIPT_FILENAME $request_filename;
  94. include /etc/nginx/fastcgi_params;
  95. fastcgi_param PATH_INFO $fastcgi_script_name;
  96. fastcgi_buffer_size 128k;
  97. fastcgi_buffers 256 4k;
  98. fastcgi_busy_buffers_size 256k;
  99. fastcgi_temp_file_write_size 256k;
  100. fastcgi_intercept_errors on;
  101. }
  102. location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
  103. root /usr/share/;
  104. }
  105. }
  106. location /phpMyAdmin {
  107. rewrite ^/* /phpmyadmin last;
  108. }
  109.  
  110. location /forum {
  111. root /var/www/ashladan.net/web;
  112. index index.php index.html index.htm;
  113. location ~ ^/forum/(.+\.php)$ {
  114. try_files $uri =404;
  115. root /var/www/ashladan.net/web;
  116. fastcgi_pass 127.0.0.1:9000;
  117. fastcgi_index index.php;
  118. fastcgi_param SCRIPT_FILENAME $request_filename;
  119. include /etc/nginx/fastcgi_params;
  120. fastcgi_param PATH_INFO $fastcgi_script_name;
  121. fastcgi_buffer_size 128k;
  122. fastcgi_buffers 256 4k;
  123. fastcgi_busy_buffers_size 256k;
  124. fastcgi_temp_file_write_size 256k;
  125. fastcgi_intercept_errors on;
  126. }
  127. location ~* ^/forum/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
  128. root /var/www/ashladan.net/web;
  129. }
  130. }
  131.  
RAW Paste Data