phpbb.stpl 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #=========================================================================#
  2. # Default Web Domain Template #
  3. # DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
  4. # https://hestiacp.com/docs/server-administration/web-templates.html #
  5. #=========================================================================#
  6. server {
  7. listen %ip%:%web_ssl_port% ssl;
  8. server_name %domain_idn% %alias_idn%;
  9. root %sdocroot%;
  10. index index.php index.html index.htm;
  11. access_log /var/log/nginx/domains/%domain%.log combined;
  12. access_log /var/log/nginx/domains/%domain%.bytes bytes;
  13. error_log /var/log/nginx/domains/%domain%.error.log error;
  14. ssl_certificate %ssl_pem%;
  15. ssl_certificate_key %ssl_key%;
  16. ssl_stapling on;
  17. ssl_stapling_verify on;
  18. # TLS 1.3 0-RTT anti-replay
  19. if ($anti_replay = 307) { return 307 https://$host$request_uri; }
  20. if ($anti_replay = 425) { return 425; }
  21. include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
  22. location = /favicon.ico {
  23. log_not_found off;
  24. access_log off;
  25. }
  26. location = /robots.txt {
  27. allow all;
  28. log_not_found off;
  29. access_log off;
  30. }
  31. location ~ /\.(?!well-known\/) {
  32. deny all;
  33. return 404;
  34. }
  35. # Based on: https://github.com/phpbb/phpbb/blob/master/phpBB/docs/nginx.sample.conf
  36. location / {
  37. try_files $uri $uri/ @rewriteapp;
  38. location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
  39. fastcgi_hide_header "Set-Cookie";
  40. }
  41. # Pass the php scripts to FastCGI server specified in upstream declaration.
  42. location ~ \.php(/|$) {
  43. include /etc/nginx/fastcgi_params;
  44. fastcgi_index index.php;
  45. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  46. fastcgi_param PATH_INFO $fastcgi_path_info;
  47. fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  48. fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
  49. fastcgi_pass %backend_lsnr%;
  50. include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
  51. try_files $uri $uri/ /app.php$is_args$args;
  52. }
  53. # Deny access to internal phpbb files.
  54. location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
  55. deny all;
  56. return 404;
  57. }
  58. }
  59. location @rewriteapp {
  60. rewrite ^(.*)$ /app.php/$1 last;
  61. }
  62. # Correctly pass scripts for installer
  63. location /install/ {
  64. try_files $uri $uri/ @rewrite_installapp =404;
  65. # Pass the php scripts to fastcgi server specified in upstream declaration.
  66. location ~ \.php(/|$) {
  67. include /etc/nginx/fastcgi_params;
  68. fastcgi_index index.php;
  69. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  70. fastcgi_param PATH_INFO $fastcgi_path_info;
  71. fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  72. fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
  73. fastcgi_pass %backend_lsnr%;
  74. include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
  75. try_files $uri $uri/ /install/app.php$is_args$args =404;
  76. }
  77. }
  78. location @rewrite_installapp {
  79. rewrite ^(.*)$ /install/app.php/$1 last;
  80. }
  81. location /error/ {
  82. alias %home%/%user%/web/%domain%/document_errors/;
  83. }
  84. location /vstats/ {
  85. alias %home%/%user%/web/%domain%/stats/;
  86. include %home%/%user%/web/%domain%/stats/auth.conf*;
  87. }
  88. proxy_hide_header Upgrade;
  89. include /etc/nginx/conf.d/phpmyadmin.inc*;
  90. include /etc/nginx/conf.d/phppgadmin.inc*;
  91. include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
  92. }