|
| 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 | + |
| 7 | +server { |
| 8 | + listen %ip%:%web_ssl_port% ssl; |
| 9 | + server_name %domain_idn% %alias_idn%; |
| 10 | + root %sdocroot%/public; |
| 11 | + index index.php index.html index.htm; |
| 12 | + access_log /var/log/nginx/domains/%domain%.log combined; |
| 13 | + access_log /var/log/nginx/domains/%domain%.bytes bytes; |
| 14 | + error_log /var/log/nginx/domains/%domain%.error.log error; |
| 15 | + |
| 16 | + ssl_certificate %ssl_pem%; |
| 17 | + ssl_certificate_key %ssl_key%; |
| 18 | + ssl_stapling on; |
| 19 | + ssl_stapling_verify on; |
| 20 | + |
| 21 | + # TLS 1.3 0-RTT anti-replay |
| 22 | + if ($anti_replay = 307) { return 307 https://$host$request_uri; } |
| 23 | + if ($anti_replay = 425) { return 425; } |
| 24 | + |
| 25 | + include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*; |
| 26 | + |
| 27 | + # Pass requests that don't refer directly to files in the filesystem to index.php |
| 28 | + location / { |
| 29 | + try_files $uri $uri/ /index.php?$query_string; |
| 30 | + } |
| 31 | + |
| 32 | + location ~ \.php$ { |
| 33 | + try_files $uri =404; |
| 34 | + |
| 35 | + include /etc/nginx/fastcgi_params; |
| 36 | + |
| 37 | + fastcgi_index index.php; |
| 38 | + fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty; |
| 39 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 40 | + |
| 41 | + fastcgi_pass %backend_lsnr%; |
| 42 | + |
| 43 | + include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*; |
| 44 | + } |
| 45 | + |
| 46 | + # Uncomment the following lines if you are not using a "public" directory |
| 47 | + # to prevent sensitive resources from being exposed. |
| 48 | + location ~* ^/(\.git|composer\.(json|lock)|auth\.json|config\.php|flarum|storage|vendor) { |
| 49 | + deny all; |
| 50 | + return 404; |
| 51 | + } |
| 52 | + |
| 53 | + # The following directives are based on best practices from H5BP Nginx Server Configs |
| 54 | + # https://github.com/h5bp/server-configs-nginx |
| 55 | + |
| 56 | + # Expire rules for static content |
| 57 | + location ~* \.(?:manifest|appcache|html?|xml|json)$ { |
| 58 | + add_header Cache-Control "max-age=0"; |
| 59 | + } |
| 60 | + |
| 61 | + location ~* \.(?:rss|atom)$ { |
| 62 | + add_header Cache-Control "max-age=3600"; |
| 63 | + } |
| 64 | + |
| 65 | + location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ { |
| 66 | + add_header Cache-Control "max-age=2592000"; |
| 67 | + access_log off; |
| 68 | + } |
| 69 | + |
| 70 | + location ~* \.(?:css|js)$ { |
| 71 | + add_header Cache-Control "max-age=31536000"; |
| 72 | + access_log off; |
| 73 | + } |
| 74 | + |
| 75 | + location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ { |
| 76 | + add_header Cache-Control "max-age=2592000"; |
| 77 | + access_log off; |
| 78 | + } |
| 79 | + |
| 80 | + location /error/ { |
| 81 | + alias %home%/%user%/web/%domain%/document_errors/; |
| 82 | + } |
| 83 | + |
| 84 | + location /vstats/ { |
| 85 | + alias %home%/%user%/web/%domain%/stats/; |
| 86 | + include %home%/%user%/web/%domain%/stats/auth.conf*; |
| 87 | + } |
| 88 | + |
| 89 | + proxy_hide_header Upgrade; |
| 90 | + |
| 91 | + include /etc/nginx/conf.d/phpmyadmin.inc*; |
| 92 | + include /etc/nginx/conf.d/phppgadmin.inc*; |
| 93 | + include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*; |
| 94 | +} |
0 commit comments