Skip to content

Commit 180e0cb

Browse files
author
Kristan Kenney
authored
Merge pull request hestiacp#274 from hestiacp/mail-web
Optimize configuration
2 parents 0d59ba9 + 21f8784 commit 180e0cb

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

install/deb/templates/mail/nginx/default.stpl

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,26 @@ server {
33
server_name %domain% %alias%;
44
ssl_certificate %ssl_pem%;
55
ssl_certificate_key %ssl_key%;
6-
error_log /var/log/%web_system%/domains/%domain%.error.log error;
7-
8-
location / {
9-
proxy_pass http://%ip%:%web_port%;
10-
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)$ {
11-
alias /var/lib/roundcube/;
12-
expires 15m;
13-
try_files $uri @fallback;
14-
}
6+
root /var/lib/roundcube;
7+
index index.php;
8+
9+
location ~ /(config|temp|logs) {
10+
deny all
11+
return 404;
1512
}
16-
17-
location /error/ {
18-
alias %home%/%user%/web/%root_domain%/document_errors/;
13+
14+
location ~ /\.(?!well-known\/) {
15+
deny all;
16+
return 404;
1917
}
2018

21-
location ~ /(config|temp|logs) {
22-
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+
}
2326
}
2427

2528
location ~ ^/(.*\.php)$ {
@@ -31,15 +34,16 @@ server {
3134
}
3235

3336
location @fallback {
34-
proxy_pass http://%ip%:%web_port%;
37+
proxy_pass http://%ip%:%web_port%;
3538
}
3639

37-
location ~ /\.ht {return 404;}
38-
location ~ /\.svn/ {return 404;}
39-
location ~ /\.git/ {return 404;}
40-
location ~ /\.hg/ {return 404;}
41-
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+
}
4247

43-
include %home%/%user%/conf/mail/%root_domain%/%proxy_system%.ssl.conf_*;
48+
include %home%/%user%/conf/mail/%root_domain%/%proxy_system%.conf_*;
4449
}
45-

0 commit comments

Comments
 (0)