Hopefully fix all Nginx reverse proxy issues, see documentation updates!

master
andryyy 2017-05-03 18:05:13 +02:00
parent fe43da48be
commit 2f0129539b
1 changed files with 24 additions and 34 deletions

View File

@ -16,6 +16,7 @@ server {
include /etc/nginx/conf.d/server_name.active; include /etc/nginx/conf.d/server_name.active;
error_log /var/log/nginx/error.log; error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log; access_log /var/log/nginx/access.log;
absolute_redirect off;
root /web; root /web;
location ~ ^/api/v1/(.*)$ { location ~ ^/api/v1/(.*)$ {
@ -33,7 +34,7 @@ server {
real_ip_recursive on; real_ip_recursive on;
location = /principals/ { location = /principals/ {
rewrite ^ $scheme://$host:$server_port/SOGo/dav; rewrite ^ $scheme://$http_host/SOGo/dav;
allow all; allow all;
} }
@ -51,16 +52,12 @@ server {
fastcgi_read_timeout 1200; fastcgi_read_timeout 1200;
} }
rewrite ^(/save.+)$ /rspamd$1 last;
location /rspamd/ { location /rspamd/ {
proxy_pass http://172.22.1.253:11334/; proxy_pass http://172.22.1.253:11334/;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; proxy_redirect off;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";
} }
location ~ /(?:a|A)utodiscover/(?:a|A)utodiscover.xml { location ~ /(?:a|A)utodiscover/(?:a|A)utodiscover.xml {
@ -91,11 +88,11 @@ server {
proxy_busy_buffers_size 64k; proxy_busy_buffers_size 64k;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_set_header x-webobjects-server-protocol HTTP/1.0; proxy_set_header x-webobjects-server-protocol HTTP/1.0;
proxy_set_header x-webobjects-remote-host $remote_addr; proxy_set_header x-webobjects-remote-host $remote_addr;
proxy_set_header x-webobjects-server-name $server_name; proxy_set_header x-webobjects-server-name $server_name;
proxy_set_header x-webobjects-server-url $scheme://$host:$server_port; proxy_set_header x-webobjects-server-url $scheme://$http_host;
proxy_set_header x-webobjects-server-port $server_port; proxy_set_header x-webobjects-server-port $server_port;
client_body_buffer_size 128k; client_body_buffer_size 128k;
client_max_body_size 100m; client_max_body_size 100m;
@ -105,11 +102,11 @@ server {
proxy_pass http://172.22.1.252:20000; proxy_pass http://172.22.1.252:20000;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_set_header x-webobjects-server-protocol HTTP/1.0; proxy_set_header x-webobjects-server-protocol HTTP/1.0;
proxy_set_header x-webobjects-remote-host $remote_addr; proxy_set_header x-webobjects-remote-host $remote_addr;
proxy_set_header x-webobjects-server-name $server_name; proxy_set_header x-webobjects-server-name $server_name;
proxy_set_header x-webobjects-server-url $scheme://$host:$server_port; proxy_set_header x-webobjects-server-url $scheme://$http_host;
proxy_set_header x-webobjects-server-port $server_port; proxy_set_header x-webobjects-server-port $server_port;
client_body_buffer_size 128k; client_body_buffer_size 128k;
client_max_body_size 100m; client_max_body_size 100m;
@ -118,7 +115,7 @@ server {
location /SOGo.woa/WebServerResources/ { location /SOGo.woa/WebServerResources/ {
proxy_pass http://172.22.1.252:9192/WebServerResources/; proxy_pass http://172.22.1.252:9192/WebServerResources/;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
@ -128,7 +125,7 @@ server {
location /.woa/WebServerResources/ { location /.woa/WebServerResources/ {
proxy_pass http://172.22.1.252:9192/WebServerResources/; proxy_pass http://172.22.1.252:9192/WebServerResources/;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
@ -138,7 +135,7 @@ server {
location /SOGo/WebServerResources/ { location /SOGo/WebServerResources/ {
proxy_pass http://172.22.1.252:9192/WebServerResources/; proxy_pass http://172.22.1.252:9192/WebServerResources/;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
@ -148,7 +145,7 @@ server {
location (^/SOGo/so/ControlPanel/Products/[^/]*UI/Resources/.*\.(jpg|png|gif|css|js)$ { location (^/SOGo/so/ControlPanel/Products/[^/]*UI/Resources/.*\.(jpg|png|gif|css|js)$ {
proxy_pass http://172.22.1.252:9192/$1.SOGo/Resources/$2; proxy_pass http://172.22.1.252:9192/$1.SOGo/Resources/$2;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
@ -164,6 +161,7 @@ server {
include /etc/nginx/conf.d/server_name.active; include /etc/nginx/conf.d/server_name.active;
error_log /var/log/nginx/error.log; error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log; access_log /var/log/nginx/access.log;
absolute_redirect off;
root /web; root /web;
location ~ ^/api/v1/(.*)$ { location ~ ^/api/v1/(.*)$ {
@ -181,7 +179,7 @@ server {
real_ip_recursive on; real_ip_recursive on;
location = /principals/ { location = /principals/ {
rewrite ^ $scheme://$host:$server_port/SOGo/dav; rewrite ^ $scheme://$http_host/SOGo/dav;
allow all; allow all;
} }
@ -199,20 +197,12 @@ server {
fastcgi_read_timeout 1200; fastcgi_read_timeout 1200;
} }
rewrite ^(/save.+)$ /rspamd$1 last;
location /rspamd/ { location /rspamd/ {
proxy_pass http://172.22.1.253:11334/; proxy_pass http://172.22.1.253:11334/;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; proxy_redirect off;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";
}
location ^~ /inc/init.sql {
deny all;
} }
location ~ /(?:a|A)utodiscover/(?:a|A)utodiscover.xml { location ~ /(?:a|A)utodiscover/(?:a|A)utodiscover.xml {
@ -243,11 +233,11 @@ server {
proxy_busy_buffers_size 64k; proxy_busy_buffers_size 64k;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_set_header x-webobjects-server-protocol HTTP/1.0; proxy_set_header x-webobjects-server-protocol HTTP/1.0;
proxy_set_header x-webobjects-remote-host $remote_addr; proxy_set_header x-webobjects-remote-host $remote_addr;
proxy_set_header x-webobjects-server-name $server_name; proxy_set_header x-webobjects-server-name $server_name;
proxy_set_header x-webobjects-server-url $scheme://$host:$server_port; proxy_set_header x-webobjects-server-url $scheme://$http_host;
proxy_set_header x-webobjects-server-port $server_port; proxy_set_header x-webobjects-server-port $server_port;
client_body_buffer_size 128k; client_body_buffer_size 128k;
client_max_body_size 100m; client_max_body_size 100m;
@ -257,11 +247,11 @@ server {
proxy_pass http://172.22.1.252:20000; proxy_pass http://172.22.1.252:20000;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_set_header x-webobjects-server-protocol HTTP/1.0; proxy_set_header x-webobjects-server-protocol HTTP/1.0;
proxy_set_header x-webobjects-remote-host $remote_addr; proxy_set_header x-webobjects-remote-host $remote_addr;
proxy_set_header x-webobjects-server-name $server_name; proxy_set_header x-webobjects-server-name $server_name;
proxy_set_header x-webobjects-server-url $scheme://$host:$server_port; proxy_set_header x-webobjects-server-url $scheme://$http_host;
proxy_set_header x-webobjects-server-port $server_port; proxy_set_header x-webobjects-server-port $server_port;
client_body_buffer_size 128k; client_body_buffer_size 128k;
client_max_body_size 100m; client_max_body_size 100m;
@ -270,7 +260,7 @@ server {
location /SOGo.woa/WebServerResources/ { location /SOGo.woa/WebServerResources/ {
proxy_pass http://172.22.1.252:9192/WebServerResources/; proxy_pass http://172.22.1.252:9192/WebServerResources/;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
@ -280,7 +270,7 @@ server {
location /.woa/WebServerResources/ { location /.woa/WebServerResources/ {
proxy_pass http://172.22.1.252:9192/WebServerResources/; proxy_pass http://172.22.1.252:9192/WebServerResources/;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
@ -290,7 +280,7 @@ server {
location /SOGo/WebServerResources/ { location /SOGo/WebServerResources/ {
proxy_pass http://172.22.1.252:9192/WebServerResources/; proxy_pass http://172.22.1.252:9192/WebServerResources/;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
@ -300,7 +290,7 @@ server {
location (^/SOGo/so/ControlPanel/Products/[^/]*UI/Resources/.*\.(jpg|png|gif|css|js)$ { location (^/SOGo/so/ControlPanel/Products/[^/]*UI/Resources/.*\.(jpg|png|gif|css|js)$ {
proxy_pass http://172.22.1.252:9192/$1.SOGo/Resources/$2; proxy_pass http://172.22.1.252:9192/$1.SOGo/Resources/$2;
proxy_set_header Host $host; proxy_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;