drupal7.tpl 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. server {
  2. listen %ip%:%web_port%;
  3. server_name %domain_idn% %alias_idn%;
  4. root %docroot%;
  5. index index.php index.html index.htm;
  6. access_log /var/log/nginx/domains/%domain%.log combined;
  7. access_log /var/log/nginx/domains/%domain%.bytes bytes;
  8. error_log /var/log/nginx/domains/%domain%.error.log error;
  9. location = /favicon.ico {
  10. log_not_found off;
  11. access_log off;
  12. }
  13. location = /robots.txt {
  14. allow all;
  15. log_not_found off;
  16. access_log off;
  17. }
  18. # Very rarely should these ever be accessed outside of your lan
  19. location ~* \.(txt|log)$ {
  20. allow 192.168.0.0/16;
  21. deny all;
  22. }
  23. location ~ \..*/.*\.php$ {
  24. return 403;
  25. }
  26. # No no for private
  27. location ~ ^/sites/.*/private/ {
  28. return 403;
  29. }
  30. # Block access to "hidden" files and directories whose names begin with a
  31. # period. This includes directories used by version control systems such
  32. # as Subversion or Git to store control files.
  33. location ~ (^|/)\. {
  34. return 403;
  35. }
  36. location / {
  37. try_files $uri @rewrite;
  38. location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
  39. expires max;
  40. }
  41. location ~ [^/]\.php(/|$) {
  42. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  43. if (!-f $document_root$fastcgi_script_name) {
  44. return 404;
  45. }
  46. fastcgi_pass %backend_lsnr%;
  47. fastcgi_index index.php;
  48. fastcgi_param SCRIPT_FILENAME $request_filename;
  49. fastcgi_intercept_errors on;
  50. include /etc/nginx/fastcgi_params;
  51. }
  52. }
  53. location @rewrite {
  54. # You have 2 options here
  55. # For D7 and above:
  56. # Clean URLs are handled in drupal_environment_initialize().
  57. rewrite ^ /index.php;
  58. }
  59. location ~ ^/sites/.*/files/styles/ {
  60. try_files $uri @rewrite;
  61. }
  62. error_page 403 /error/404.html;
  63. error_page 404 /error/404.html;
  64. error_page 500 502 503 504 /error/50x.html;
  65. location /error/ {
  66. alias %home%/%user%/web/%domain%/document_errors/;
  67. }
  68. location ~* "/\.(htaccess|htpasswd)$" {
  69. deny all;
  70. return 404;
  71. }
  72. location /vstats/ {
  73. alias %home%/%user%/web/%domain%/stats/;
  74. include %home%/%user%/conf/web/%domain%.auth*;
  75. }
  76. include /etc/nginx/conf.d/phpmyadmin.inc*;
  77. include /etc/nginx/conf.d/phppgadmin.inc*;
  78. include /etc/nginx/conf.d/webmail.inc*;
  79. include %home%/%user%/conf/web/nginx.%domain%.conf*;
  80. }