@@ -30,46 +30,9 @@ server {
3030 access_log off;
3131 }
3232
33- # Gzip Settings, convert all types.
34- gzip on;
35- gzip_vary on;
36- gzip_proxied any;
37-
38- # Can be enhance to 5, but it can slow you server
39- # gzip_comp_level 5;
40- # gzip_min_length 256;
41-
42- gzip_types
43- application/atom+xml
44- application/javascript
45- application/json
46- application/ld+json
47- application/manifest+json
48- application/rss+xml
49- application/vnd.geo+json
50- application/vnd.ms-fontobject
51- application/x-font-ttf
52- application/x-web-app-manifest+json
53- application/xhtml+xml
54- application/xml
55- font/opentype
56- image/bmp
57- image/svg+xml
58- image/x-icon
59- text/cache-manifest
60- text/css
61- text/plain
62- text/vcard
63- text/vnd.rim.location.xloc
64- text/vtt
65- text/x-component
66- text/x-cross-domain-policy;
67-
68- gzip_disable "MSIE [1-6]\.(?!.*SV1)";
69-
70- # Cloudflare / Max CDN fix
71- location ~* \.(eot|otf|ttf|woff(?:2)?)$ {
72- add_header Access-Control-Allow-Origin *;
33+ location ~ /\.(?!well-known\/) {
34+ deny all;
35+ return 404;
7336 }
7437
7538 # Force pdf files to be downloaded
@@ -78,7 +41,7 @@ server {
7841 add_header X-Content-Type-Options nosniff;
7942 }
8043
81- # Force files inupload directory to be downloaded
44+ # Force files in upload directory to be downloaded
8245 location ~ ^/upload/ {
8346 add_header Content-Disposition Attachment;
8447 add_header X-Content-Type-Options nosniff;
@@ -112,77 +75,72 @@ server {
11275 # Source code directories
11376 location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
11477 deny all;
78+ return 404;
11579 }
80+
11681 # vendor in modules directory
11782 location ~ ^/modules/.*/vendor/ {
11883 deny all;
84+ return 404;
11985 }
86+
12087 # Prevent exposing other sensitive files
12188 location ~ \.(yml|log|tpl|twig|sass)$ {
12289 deny all;
90+ return 404;
12391 }
12492
12593 # Prevent injection of php files
12694 location /upload {
12795 location ~ \.php$ {
12896 deny all;
97+ return 404;
12998 }
13099 }
131100 location /img {
132101 location ~ \.php$ {
133102 deny all;
103+ return 404;
134104 }
135105 }
136106
137107 location / {
138- try_files $uri $uri/ /index.php?$args;
108+ try_files $uri $uri/ /index.php?$args;
139109
140110 if (!-e $request_filename)
141111 {
142112 rewrite ^(.+)$ /index.php?q=$1 last;
143113 }
144114
145- location ~* ^.+\.(jpeg| jpg|png |gif|bmp |ico|svg| css|js)$ {
146- expires max ;
147- fastcgi_hide_header "Set-Cookie";
115+ location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom| jpg|jpeg |gif|png |ico|bmp|mid|midi|wav|rtf| css|js|jar )$ {
116+ expires 30d ;
117+ fastcgi_hide_header "Set-Cookie";
148118 }
149119
150120 location ~ [^/]\.php(/|$) {
151- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
152-
153- try_files $fastcgi_script_name /index.php$uri&$args =404;
154-
155- # Environment variables for PHP
156- fastcgi_split_path_info ^(.+\.php)(/.+)$;
157-
158- fastcgi_pass %backend_lsnr%;
159- fastcgi_index index.php;
160- include /etc/nginx/fastcgi_params;
121+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
122+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
123+ try_files $fastcgi_script_name /index.php$uri&$args =404;
124+ fastcgi_pass %backend_lsnr%;
125+ fastcgi_index index.php;
126+ include /etc/nginx/fastcgi_params;
161127 }
162128 }
163129
164- error_page 403 /error/404.html;
165- error_page 404 /index.php?controller=404;
166- error_page 500 502 503 504 /error/50x.html;
167-
130+ error_page 403 /error/404.html;
131+ error_page 404 /index.php?controller=404;
132+ error_page 500 502 503 504 /error/50x.html;
168133
169134 location /error/ {
170135 alias %home%/%user%/web/%domain%/document_errors/;
171136 }
172137
173- location ~* "/\.(htaccess|htpasswd)$" {
174- deny all;
175- return 404;
176- }
177-
178138 location /vstats/ {
179139 alias %home%/%user%/web/%domain%/stats/;
180140 include %home%/%user%/web/%domain%/stats/auth.conf*;
181141 }
182142
183143 include /etc/nginx/conf.d/phpmyadmin.inc*;
184144 include /etc/nginx/conf.d/phppgadmin.inc*;
185- include /etc/nginx/conf.d/webmail.inc*;
186-
187145 include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
188146}
0 commit comments