Skip to content

Commit d503b7c

Browse files
author
Kristan Kenney
committed
Fix webmail alias for php-fpm configurations
1 parent 41d96f2 commit d503b7c

File tree

4 files changed

+102
-43
lines changed

4 files changed

+102
-43
lines changed

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

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ server {
66
root /var/lib/roundcube;
77
index index.php;
88

9+
location / {
10+
proxy_pass http://%ip%:%web_port%;
11+
try_files $uri $uri/ /index.php?q=$uri&$args;
12+
alias /var/lib/roundcube/;
13+
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)$ {
14+
expires 1h;
15+
fastcgi_hide_header "Set-Cookie";
16+
}
17+
}
18+
919
location ~ /(config|temp|logs) {
1020
deny all;
1121
return 404;
@@ -16,13 +26,16 @@ server {
1626
return 404;
1727
}
1828

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-
}
29+
location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
30+
deny all;
31+
return 404;
32+
}
33+
34+
location ~ /\. {
35+
return 404;
36+
deny all;
37+
access_log off;
38+
log_not_found off;
2639
}
2740

2841
location ~ ^/(.*\.php)$ {
@@ -37,13 +50,14 @@ server {
3750
proxy_pass http://%ip%:%web_port%;
3851
}
3952

53+
location /error/ {
54+
root /var/www/document_errors;
55+
}
56+
4057
error_page 403 /error/404.html;
4158
error_page 404 /error/404.html;
4259
error_page 500 502 503 504 /error/50x.html;
4360

44-
location /error/ {
45-
alias %home%/%user%/web/%root_domain%/document_errors/;
46-
}
4761

4862
include %home%/%user%/conf/mail/%root_domain%/%proxy_system%.conf_*;
4963
}

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

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@ server {
55
index index.php;
66
77
include %home%/%user%/conf/mail/%root_domain%/nginx.forcessl.conf*;
8-
8+
9+
location / {
10+
proxy_pass http://%ip%:%web_port%;
11+
try_files $uri $uri/ /index.php?q=$uri&$args;
12+
alias /var/lib/roundcube/;
13+
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)$ {
14+
expires 1h;
15+
fastcgi_hide_header "Set-Cookie";
16+
}
17+
}
18+
919
location ~ /(config|temp|logs) {
1020
deny all;
1121
return 404;
@@ -16,13 +26,16 @@ server {
1626
return 404;
1727
}
1828

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-
}
29+
location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
30+
deny all;
31+
return 404;
32+
}
33+
34+
location ~ /\. {
35+
return 404;
36+
deny all;
37+
access_log off;
38+
log_not_found off;
2639
}
2740

2841
location ~ ^/(.*\.php)$ {
@@ -37,13 +50,13 @@ server {
3750
proxy_pass http://%ip%:%web_port%;
3851
}
3952

53+
location /error/ {
54+
root /var/www/document_errors;
55+
}
56+
4057
error_page 403 /error/404.html;
4158
error_page 404 /error/404.html;
4259
error_page 500 502 503 504 /error/50x.html;
43-
44-
location /error/ {
45-
alias %home%/%user%/web/%root_domain%/document_errors/;
46-
}
4760

4861
include %home%/%user%/conf/mail/%root_domain%/%proxy_system%.conf_*;
4962
}

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

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ server {
66
root /var/lib/roundcube;
77
index index.php;
88

9+
location =/ {
10+
try_files $uri $uri/ /index.php?q=$uri&$args;
11+
}
12+
13+
location / {
14+
try_files $uri $uri/ /index.php?q=$uri&$args;
15+
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)$ {
16+
expires 1h;
17+
fastcgi_hide_header "Set-Cookie";
18+
}
19+
}
20+
921
location ~ /(config|temp|logs) {
1022
deny all;
1123
return 404;
@@ -15,13 +27,17 @@ server {
1527
deny all;
1628
return 404;
1729
}
30+
31+
location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
32+
deny all;
33+
return 404;
34+
}
1835

19-
location / {
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-
expires 1h;
23-
fastcgi_hide_header "Set-Cookie";
24-
}
36+
location ~ /\. {
37+
return 404;
38+
deny all;
39+
access_log off;
40+
log_not_found off;
2541
}
2642

2743
location ~ ^/(.*\.php)$ {
@@ -32,13 +48,13 @@ server {
3248
fastcgi_param SCRIPT_FILENAME $request_filename;
3349
}
3450

51+
location /error/ {
52+
root /var/www/document_errors;
53+
}
54+
3555
error_page 403 /error/404.html;
3656
error_page 404 /error/404.html;
3757
error_page 500 502 503 504 /error/50x.html;
38-
39-
location /error/ {
40-
alias %home%/%user%/web/%root_domain%/document_errors/;
41-
}
4258

4359
include %home%/%user%/conf/mail/%root_domain%/%web_system%.conf_*;
4460
}

install/deb/templates/mail/nginx/web_system.tpl

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@ server {
55
index index.php;
66
77
include %home%/%user%/conf/mail/%root_domain%/nginx.forcessl.conf*;
8-
8+
9+
location =/ {
10+
try_files $uri $uri/ /index.php?q=$uri&$args;
11+
}
12+
13+
location / {
14+
try_files $uri $uri/ /index.php?q=$uri&$args;
15+
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)$ {
16+
expires 1h;
17+
fastcgi_hide_header "Set-Cookie";
18+
}
19+
}
20+
921
location ~ /(config|temp|logs) {
1022
deny all;
1123
return 404;
@@ -15,13 +27,17 @@ server {
1527
deny all;
1628
return 404;
1729
}
30+
31+
location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
32+
deny all;
33+
return 404;
34+
}
1835

19-
location / {
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-
expires 1h;
23-
fastcgi_hide_header "Set-Cookie";
24-
}
36+
location ~ /\. {
37+
return 404;
38+
deny all;
39+
access_log off;
40+
log_not_found off;
2541
}
2642

2743
location ~ ^/(.*\.php)$ {
@@ -32,13 +48,13 @@ server {
3248
fastcgi_param SCRIPT_FILENAME $request_filename;
3349
}
3450

51+
location /error/ {
52+
root /var/www/document_errors;
53+
}
54+
3555
error_page 403 /error/404.html;
3656
error_page 404 /error/404.html;
3757
error_page 500 502 503 504 /error/50x.html;
3858

39-
location /error/ {
40-
alias %home%/%user%/web/%root_domain%/document_errors/;
41-
}
42-
4359
include %home%/%user%/conf/mail/%root_domain%/%web_system%.conf_*;
4460
}

0 commit comments

Comments
 (0)