|
| 1 | +#=======================================================================# |
| 2 | +# Default Web Domain Template # |
| 3 | +# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS # |
| 4 | +#=======================================================================# |
| 5 | + |
| 6 | +server { |
| 7 | + listen %ip%:%web_ssl_port% ssl http2; |
| 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 | + |
| 15 | + ssl_certificate %ssl_pem%; |
| 16 | + ssl_certificate_key %ssl_key%; |
| 17 | + ssl_stapling on; |
| 18 | + ssl_stapling_verify on; |
| 19 | + |
| 20 | + include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*; |
| 21 | + |
| 22 | + |
| 23 | + # redirect some entire folders |
| 24 | + rewrite ^/(vendor|translations|build)/.* /index.php break; |
| 25 | + |
| 26 | + location / { |
| 27 | + |
| 28 | + include %home%/%user%/conf/web/nginx.%domain%.rules.conf*; |
| 29 | + |
| 30 | + # First attempt to serve request as file, then |
| 31 | + # as directory, then fall back to index.html |
| 32 | + # one option: try_files $uri $uri/ /index.php$is_args$args; |
| 33 | + try_files $uri /index.php$is_args$args; |
| 34 | + # Uncomment to enable naxsi on this location |
| 35 | + # include /etc/nginx/naxsi.rules |
| 36 | + |
| 37 | + location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ { |
| 38 | + expires max; |
| 39 | + fastcgi_hide_header "Set-Cookie"; |
| 40 | + } |
| 41 | + |
| 42 | + } |
| 43 | + |
| 44 | + # Deny everything else in /app folder except Assets folder in bundles |
| 45 | + location ~ /app/bundles/.*/Assets/ { |
| 46 | + allow all; |
| 47 | + access_log off; |
| 48 | + } |
| 49 | + location ~ /app/ { deny all; } |
| 50 | + |
| 51 | + # Deny everything else in /addons or /plugins folder except Assets folder in bundles |
| 52 | + location ~ /(addons|plugins)/.*/Assets/ { |
| 53 | + allow all; |
| 54 | + access_log off; |
| 55 | + } |
| 56 | + # location ~ /(addons|plugins)/ { deny all; } |
| 57 | + |
| 58 | + # Deny all php files in themes folder |
| 59 | + location ~* ^/themes/(.*)\.php { |
| 60 | + deny all; |
| 61 | + } |
| 62 | + |
| 63 | + location ~ [^/]\.php(/|$) { |
| 64 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 65 | + fastcgi_pass %backend_lsnr%; |
| 66 | + fastcgi_index index.php; |
| 67 | + include /etc/nginx/fastcgi_params; |
| 68 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 69 | + include fastcgi_params; |
| 70 | + fastcgi_split_path_info ^(.+.php)(/.+)$; |
| 71 | + |
| 72 | + |
| 73 | + } |
| 74 | + |
| 75 | + location /error/ { |
| 76 | + alias %home%/%user%/web/%domain%/document_errors/; |
| 77 | + } |
| 78 | + |
| 79 | + location ~* "/\.(htaccess|htpasswd)$" { |
| 80 | + deny all; |
| 81 | + return 404; |
| 82 | + } |
| 83 | + |
| 84 | + location /vstats/ { |
| 85 | + alias %home%/%user%/web/%domain%/stats/; |
| 86 | + include %home%/%user%/web/%domain%/stats/auth.conf*; |
| 87 | + } |
| 88 | + |
| 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 | +} |
0 commit comments