Skip to content

Commit aee6772

Browse files
Optimize configuration
1 parent 560f569 commit aee6772

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed
Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
server {
22
listen %ip%:%web_port%;
33
server_name %domain% %alias%;
4-
root /var/lib/roundcube;
5-
index index.php;
4+
root /var/lib/roundcube;
5+
index index.php;
66
77
include %home%/%user%/conf/mail/%root_domain%/nginx.forcessl.conf*;
8+
9+
location ~ /(config|temp|logs) {
10+
deny all
11+
return 404;
12+
}
13+
14+
location ~ /\.(?!well-known\/) {
15+
deny all;
16+
return 404;
17+
}
818

919
location / {
10-
try_files $uri $uri/ /index.php?$args;
11-
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)$ {
12-
alias /var/lib/roundcube/;
13-
expires 15m;
20+
try_files $uri $uri/ /index.php?$args;
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+
fastcgi_hide_header "Set-Cookie";
1425
}
1526
}
1627

17-
location /error/ {
18-
alias %home%/%user%/web/%root_domain%/document_errors/;
19-
}
20-
21-
location ~ /(config|temp|logs) {
22-
return 404;
23-
}
24-
2528
location ~ ^/(.*\.php)$ {
2629
alias /var/lib/roundcube/$1;
2730
fastcgi_pass 127.0.0.1:9000;
@@ -30,11 +33,13 @@ server {
3033
fastcgi_param SCRIPT_FILENAME $request_filename;
3134
}
3235

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

3944
include %home%/%user%/conf/mail/%root_domain%/%web_system%.conf_*;
4045
}

0 commit comments

Comments
 (0)