From 83fb8c0fd8d18c297cdfd11be9c32ef28c77d5fb Mon Sep 17 00:00:00 2001 From: "andre.peters" Date: Sun, 21 Jan 2018 14:59:45 +0100 Subject: [PATCH] [Nginx] Use names instead of IPs --- data/conf/nginx/dynmaps.conf | 2 +- data/conf/nginx/site.conf | 35 +++++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/data/conf/nginx/dynmaps.conf b/data/conf/nginx/dynmaps.conf index 3ff8692f..99c0c6aa 100644 --- a/data/conf/nginx/dynmaps.conf +++ b/data/conf/nginx/dynmaps.conf @@ -10,7 +10,7 @@ server { location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass phpfpm:9000; + fastcgi_pass phpfpm:9001; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; diff --git a/data/conf/nginx/site.conf b/data/conf/nginx/site.conf index 89572eff..ede9fe4a 100644 --- a/data/conf/nginx/site.conf +++ b/data/conf/nginx/site.conf @@ -7,6 +7,13 @@ map $http_x_forwarded_proto $client_req_scheme { https https; } +server { + listen 80 default_server; + listen [::]:80 default_server; + include /etc/nginx/conf.d/server_name.active; + return 301 https://$host$request_uri; +} + server { include /etc/nginx/mime.types; charset utf-8; @@ -65,7 +72,7 @@ server { } location /rspamd/ { - proxy_pass http://172.22.1.253:11334/; + proxy_pass http://rspamd:11334/; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; @@ -97,7 +104,7 @@ server { } location ^~ /Microsoft-Server-ActiveSync { - proxy_pass http://172.22.1.252:20000/SOGo/Microsoft-Server-ActiveSync; + proxy_pass http://sogo:20000/SOGo/Microsoft-Server-ActiveSync; proxy_connect_timeout 1000; proxy_next_upstream timeout error; proxy_send_timeout 1000; @@ -119,7 +126,7 @@ server { } location ^~ /SOGo { - proxy_pass http://172.22.1.252:20000; + proxy_pass http://sogo:20000; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; @@ -134,7 +141,7 @@ server { } location /SOGo.woa/WebServerResources/ { - proxy_pass http://172.22.1.252:9192/WebServerResources/; + proxy_pass http://sogo:9192/WebServerResources/; proxy_set_header Host $http_host; proxy_cache sogo; proxy_cache_valid 200 1d; @@ -144,7 +151,7 @@ server { } location /.woa/WebServerResources/ { - proxy_pass http://172.22.1.252:9192/WebServerResources/; + proxy_pass http://sogo:9192/WebServerResources/; proxy_set_header Host $http_host; proxy_cache sogo; proxy_cache_valid 200 1d; @@ -154,7 +161,7 @@ server { } location /SOGo/WebServerResources/ { - proxy_pass http://172.22.1.252:9192/WebServerResources/; + proxy_pass http://sogo:9192/WebServerResources/; proxy_set_header Host $http_host; proxy_cache sogo; proxy_cache_valid 200 1d; @@ -164,7 +171,7 @@ server { } 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://sogo:9192/$1.SOGo/Resources/$2; proxy_set_header Host $http_host; proxy_cache sogo; proxy_cache_valid 200 1d; @@ -243,7 +250,7 @@ server { } location /rspamd/ { - proxy_pass http://172.22.1.253:11334/; + proxy_pass http://rspamd:11334/; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; @@ -275,7 +282,7 @@ server { } location ^~ /Microsoft-Server-ActiveSync { - proxy_pass http://172.22.1.252:20000/SOGo/Microsoft-Server-ActiveSync; + proxy_pass http://sogo:20000/SOGo/Microsoft-Server-ActiveSync; proxy_connect_timeout 1000; proxy_next_upstream timeout error; proxy_send_timeout 1000; @@ -297,7 +304,7 @@ server { } location ^~ /SOGo { - proxy_pass http://172.22.1.252:20000; + proxy_pass http://sogo:20000; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; @@ -312,7 +319,7 @@ server { } location /SOGo.woa/WebServerResources/ { - proxy_pass http://172.22.1.252:9192/WebServerResources/; + proxy_pass http://sogo:9192/WebServerResources/; proxy_set_header Host $http_host; proxy_cache sogo; proxy_cache_valid 200 1d; @@ -322,7 +329,7 @@ server { } location /.woa/WebServerResources/ { - proxy_pass http://172.22.1.252:9192/WebServerResources/; + proxy_pass http://sogo:9192/WebServerResources/; proxy_set_header Host $http_host; proxy_cache sogo; proxy_cache_valid 200 1d; @@ -332,7 +339,7 @@ server { } location /SOGo/WebServerResources/ { - proxy_pass http://172.22.1.252:9192/WebServerResources/; + proxy_pass http://sogo:9192/WebServerResources/; proxy_set_header Host $http_host; proxy_cache sogo; proxy_cache_valid 200 1d; @@ -342,7 +349,7 @@ server { } 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://sogo:9192/$1.SOGo/Resources/$2; proxy_set_header Host $http_host; proxy_cache sogo; proxy_cache_valid 200 1d;