|
| 1 | +#=========================================================================# |
| 2 | +# Default Web Domain Template # |
| 3 | +# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS # |
| 4 | +# https://docs.hestiacp.com/admin_docs/web.html#how-do-web-templates-work # |
| 5 | +#=========================================================================# |
| 6 | + |
| 7 | +server { |
| 8 | + listen %ip%:%web_port%; |
| 9 | + server_name %domain_idn% %alias_idn%; |
| 10 | + root %docroot%; |
| 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.forcessl.conf*; |
| 22 | +
|
| 23 | + # Pass requests that don't refer directly to files in the filesystem to index.php |
| 24 | + location / { |
| 25 | + try_files $uri $uri/ /index.php?$query_string; |
| 26 | + } |
| 27 | +
|
| 28 | + location ~ \.php$ { |
| 29 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 30 | + try_files $uri =404; |
| 31 | + fastcgi_pass %backend_lsnr%; |
| 32 | + fastcgi_index index.php; |
| 33 | + include /etc/nginx/fastcgi_params; |
| 34 | + include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*; |
| 35 | + } |
| 36 | +
|
| 37 | + #Uncomment the following lines if you are not using a `public` directory |
| 38 | + #to prevent sensitive resources from being exposed. |
| 39 | + location ~* ^/(\.git|composer\.(json|lock)|auth\.json|config\.php|flarum|storage|vendor) { |
| 40 | + deny all; |
| 41 | + return 404; |
| 42 | + } |
| 43 | +
|
| 44 | + # The following directives are based on best practices from H5BP Nginx Server Configs |
| 45 | + # https://github.com/h5bp/server-configs-nginx |
| 46 | +
|
| 47 | + # Expire rules for static content |
| 48 | + location ~* \.(?:manifest|appcache|html?|xml|json)$ { |
| 49 | + add_header Cache-Control "max-age=0"; |
| 50 | + } |
| 51 | +
|
| 52 | + location ~* \.(?:rss|atom)$ { |
| 53 | + add_header Cache-Control "max-age=3600"; |
| 54 | + } |
| 55 | +
|
| 56 | + location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ { |
| 57 | + add_header Cache-Control "max-age=2592000"; |
| 58 | + access_log off; |
| 59 | + } |
| 60 | +
|
| 61 | + location ~* \.(?:css|js)$ { |
| 62 | + add_header Cache-Control "max-age=31536000"; |
| 63 | + access_log off; |
| 64 | + } |
| 65 | +
|
| 66 | + location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ { |
| 67 | + add_header Cache-Control "max-age=2592000"; |
| 68 | + access_log off; |
| 69 | + } |
| 70 | +
|
| 71 | + # Gzip compression |
| 72 | + gzip on; |
| 73 | + gzip_comp_level 5; |
| 74 | + gzip_min_length 256; |
| 75 | + gzip_proxied any; |
| 76 | + gzip_vary on; |
| 77 | + gzip_types |
| 78 | + application/atom+xml |
| 79 | + application/javascript |
| 80 | + application/json |
| 81 | + application/ld+json |
| 82 | + application/manifest+json |
| 83 | + application/rss+xml |
| 84 | + application/vnd.geo+json |
| 85 | + application/vnd.ms-fontobject |
| 86 | + application/x-font-ttf |
| 87 | + application/x-web-app-manifest+json |
| 88 | + application/xhtml+xml |
| 89 | + application/xml |
| 90 | + font/opentype |
| 91 | + image/bmp |
| 92 | + image/svg+xml |
| 93 | + image/x-icon |
| 94 | + text/cache-manifest |
| 95 | + text/css |
| 96 | + text/javascript |
| 97 | + text/plain |
| 98 | + text/vcard |
| 99 | + text/vnd.rim.location.xloc |
| 100 | + text/vtt |
| 101 | + text/x-component |
| 102 | + text/x-cross-domain-policy; |
| 103 | +
|
| 104 | + location /error/ { |
| 105 | + alias %home%/%user%/web/%domain%/document_errors/; |
| 106 | + } |
| 107 | +
|
| 108 | + location /vstats/ { |
| 109 | + alias %home%/%user%/web/%domain%/stats/; |
| 110 | + include %home%/%user%/web/%domain%/stats/auth.conf*; |
| 111 | + } |
| 112 | +
|
| 113 | + include /etc/nginx/conf.d/phpmyadmin.inc*; |
| 114 | + include /etc/nginx/conf.d/phppgadmin.inc*; |
| 115 | + include %home%/%user%/conf/web/%domain%/nginx.conf_*; |
| 116 | +} |
0 commit comments