drupal-composer.stpl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. server {
  2. listen %ip%:%web_ssl_port% ssl http2;
  3. server_name %domain_idn% %alias_idn%;
  4. root %docroot%/web;
  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_certificate %ssl_pem%;
  10. ssl_certificate_key %ssl_key%;
  11. ssl_stapling on;
  12. ssl_stapling_verify on;
  13. include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
  14. location = /favicon.ico {
  15. log_not_found off;
  16. access_log off;
  17. }
  18. location = /robots.txt {
  19. allow all;
  20. log_not_found off;
  21. access_log off;
  22. }
  23. location ~ \..*/.*\.php$ {
  24. deny all;
  25. return 404;
  26. }
  27. location ~ ^/sites/.*/private/ {
  28. deny all;
  29. return 404;
  30. }
  31. location ~ ^/sites/[^/]+/files/.*\.php$ {
  32. deny all;
  33. return 404;
  34. }
  35. location ~ /\.(?!well-known\/) {
  36. deny all;
  37. return 404;
  38. }
  39. location / {
  40. try_files $uri $uri/ /index.php?$query_string;
  41. location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
  42. try_files $uri @rewrite;
  43. expires 30d;
  44. fastcgi_hide_header "Set-Cookie";
  45. }
  46. location ~ [^/]\.php(/|$)|^/update.php {
  47. fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
  48. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  49. try_files $uri =404;
  50. fastcgi_pass %backend_lsnr%;
  51. fastcgi_index index.php;
  52. fastcgi_param SCRIPT_FILENAME $request_filename;
  53. include /etc/nginx/fastcgi_params;
  54. }
  55. location ~ ^/sites/.*/files/styles/ {
  56. try_files $uri @rewrite;
  57. }
  58. }
  59. location @rewrite {
  60. rewrite ^/(.*)$ /index.php?q=$1;
  61. }
  62. rewrite ^/index.php/(.*) /$1 permanent;
  63. location /error/ {
  64. alias %home%/%user%/web/%domain%/document_errors/;
  65. }
  66. location /vstats/ {
  67. alias %home%/%user%/web/%domain%/stats/;
  68. include %home%/%user%/web/%domain%/stats/auth.conf*;
  69. }
  70. include /etc/nginx/conf.d/phpmyadmin.inc*;
  71. include /etc/nginx/conf.d/phppgadmin.inc*;
  72. include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
  73. }