drupal8.stpl 2.7 KB

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