|
| 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 | + |
1 | 7 | server { |
2 | | - listen %ip%:%web_ssl_port% ssl http2; |
3 | | - server_name %domain_idn% %alias_idn%; |
4 | | - root %sdocroot%/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 | | - |
10 | | - ssl_certificate %ssl_pem%; |
11 | | - ssl_certificate_key %ssl_key%; |
12 | | - ssl_stapling on; |
13 | | - ssl_stapling_verify on; |
14 | | - |
15 | | - include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*; |
16 | | - |
17 | | - location / { |
18 | | - try_files $uri $uri/ /index.php?$query_string; |
19 | | - location ~* ^.+\.(jpeg|jpg|png|webp|gif|bmp|ico|svg|css|js|webp)$ { |
20 | | - expires max; |
21 | | - fastcgi_hide_header "Set-Cookie"; |
22 | | - } |
23 | | - |
24 | | - location ~ [^/]\.php(/|$) { |
25 | | - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
26 | | - if (!-f $document_root$fastcgi_script_name) { |
27 | | - return 404; |
28 | | - } |
29 | | - |
30 | | - fastcgi_pass %backend_lsnr%; |
31 | | - fastcgi_index index.php; |
32 | | - include /etc/nginx/fastcgi_params; |
33 | | - } |
34 | | - } |
35 | | - |
36 | | - location /error/ { |
37 | | - alias %home%/%user%/web/%domain%/document_errors/; |
38 | | - } |
39 | | - |
40 | | - location ~* "/\.(htaccess|htpasswd)$" { |
41 | | - deny all; |
42 | | - return 404; |
43 | | - } |
44 | | - |
45 | | - location /vstats/ { |
46 | | - alias %home%/%user%/web/%domain%/stats/; |
47 | | - include %home%/%user%/web/%domain%/stats/auth.conf*; |
48 | | - } |
49 | | - |
50 | | - include /etc/nginx/conf.d/phpmyadmin.inc*; |
51 | | - include /etc/nginx/conf.d/phppgadmin.inc*; |
52 | | - include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*; |
| 8 | + listen %ip%:%web_ssl_port% ssl http2; |
| 9 | + server_name %domain_idn% %alias_idn%; |
| 10 | + root %sdocroot%/web; |
| 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 | + include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*; |
| 22 | + |
| 23 | + location = /favicon.ico { |
| 24 | + log_not_found off; |
| 25 | + access_log off; |
| 26 | + } |
| 27 | + |
| 28 | + location = /robots.txt { |
| 29 | + allow all; |
| 30 | + log_not_found off; |
| 31 | + access_log off; |
| 32 | + } |
| 33 | + |
| 34 | + location ~ /\.(?!well-known\/) { |
| 35 | + deny all; |
| 36 | + return 404; |
| 37 | + } |
| 38 | + |
| 39 | + location / { |
| 40 | + try_files $uri $uri/ /index.php?$args; |
| 41 | + 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)$ { |
| 42 | + expires 30d; |
| 43 | + fastcgi_hide_header "Set-Cookie"; |
| 44 | + } |
| 45 | + |
| 46 | + # Craft-specific location handlers to ensure AdminCP requests route through index.php |
| 47 | + # If you change your `cpTrigger`, change it here as well |
| 48 | + location ^~ /admin { |
| 49 | + try_files $uri $uri/ /index.php?$query_string; |
| 50 | + } |
| 51 | + location ^~ /cpresources { |
| 52 | + try_files $uri $uri/ /index.php?$query_string; |
| 53 | + } |
| 54 | + |
| 55 | + location ~ [^/]\.php(/|$) { |
| 56 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 57 | + try_files $uri =404; |
| 58 | + fastcgi_pass %backend_lsnr%; |
| 59 | + fastcgi_index index.php; |
| 60 | + include /etc/nginx/fastcgi_params; |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + location /error/ { |
| 65 | + alias %home%/%user%/web/%domain%/document_errors/; |
| 66 | + } |
| 67 | + |
| 68 | + location /vstats/ { |
| 69 | + alias %home%/%user%/web/%domain%/stats/; |
| 70 | + include %home%/%user%/web/%domain%/stats/auth.conf*; |
| 71 | + } |
| 72 | + |
| 73 | + proxy_hide_header Upgrade; |
| 74 | + |
| 75 | + include /etc/nginx/conf.d/phpmyadmin.inc*; |
| 76 | + include /etc/nginx/conf.d/phppgadmin.inc*; |
| 77 | + include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*; |
53 | 78 | } |
0 commit comments