Skip to content

Commit 8685891

Browse files
Optimize configuration
1 parent 9f79f33 commit 8685891

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed
Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
server {
22
listen %ip%:%proxy_port%;
33
server_name %domain% %alias%;
4-
5-
include %home%/%user%/conf/mail/%root_domain%/nginx.forcessl.conf*;
4+
root /var/lib/roundcube;
5+
index index.php;
66
7-
location / {
8-
proxy_pass http://%ip%:%web_port%;
9-
location ~* ^.+\.(jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm)$ {
10-
alias /var/lib/roundcube/;
11-
expires 15m;
12-
try_files $uri @fallback;
13-
}
7+
include %home%/%user%/conf/mail/%root_domain%/nginx.forcessl.conf*;
8+
9+
location ~ /(config|temp|logs) {
10+
deny all
11+
return 404;
1412
}
15-
16-
location /error/ {
17-
alias %home%/%user%/web/%root_domain%/document_errors/;
13+
14+
location ~ /\.(?!well-known\/) {
15+
deny all;
16+
return 404;
1817
}
1918

20-
location ~ /(config|temp|logs) {
21-
return 404;
19+
location / {
20+
proxy_pass http://%ip%:%web_port%;
21+
location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
22+
alias /var/lib/roundcube/;
23+
expires 1h;
24+
try_files $uri @fallback;
25+
}
2226
}
2327

2428
location ~ ^/(.*\.php)$ {
@@ -30,14 +34,16 @@ server {
3034
}
3135

3236
location @fallback {
33-
proxy_pass http://%ip%:%web_port%;
37+
proxy_pass http://%ip%:%web_port%;
3438
}
3539

36-
location ~ /\.ht {return 404;}
37-
location ~ /\.svn/ {return 404;}
38-
location ~ /\.git/ {return 404;}
39-
location ~ /\.hg/ {return 404;}
40-
location ~ /\.bzr/ {return 404;}
40+
error_page 403 /error/404.html;
41+
error_page 404 /error/404.html;
42+
error_page 500 502 503 504 /error/50x.html;
43+
44+
location /error/ {
45+
alias %home%/%user%/web/%root_domain%/document_errors/;
46+
}
4147

4248
include %home%/%user%/conf/mail/%root_domain%/%proxy_system%.conf_*;
43-
}
49+
}

0 commit comments

Comments
 (0)