[Nginx] Use names instead of IPs

master
andre.peters 2018-01-21 14:59:45 +01:00
parent 08c8976a95
commit 83fb8c0fd8
2 changed files with 22 additions and 15 deletions

View File

@ -10,7 +10,7 @@ server {
location ~ \.php$ { location ~ \.php$ {
try_files $uri =404; try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9000; fastcgi_pass phpfpm:9001;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

View File

@ -7,6 +7,13 @@ map $http_x_forwarded_proto $client_req_scheme {
https https; 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 { server {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
charset utf-8; charset utf-8;
@ -65,7 +72,7 @@ server {
} }
location /rspamd/ { location /rspamd/ {
proxy_pass http://172.22.1.253:11334/; proxy_pass http://rspamd:11334/;
proxy_set_header Host $http_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;
@ -97,7 +104,7 @@ server {
} }
location ^~ /Microsoft-Server-ActiveSync { 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_connect_timeout 1000;
proxy_next_upstream timeout error; proxy_next_upstream timeout error;
proxy_send_timeout 1000; proxy_send_timeout 1000;
@ -119,7 +126,7 @@ server {
} }
location ^~ /SOGo { 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-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 $http_host; proxy_set_header Host $http_host;
@ -134,7 +141,7 @@ server {
} }
location /SOGo.woa/WebServerResources/ { 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_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
@ -144,7 +151,7 @@ server {
} }
location /.woa/WebServerResources/ { 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_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
@ -154,7 +161,7 @@ server {
} }
location /SOGo/WebServerResources/ { 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_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
@ -164,7 +171,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://sogo:9192/$1.SOGo/Resources/$2;
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
@ -243,7 +250,7 @@ server {
} }
location /rspamd/ { location /rspamd/ {
proxy_pass http://172.22.1.253:11334/; proxy_pass http://rspamd:11334/;
proxy_set_header Host $http_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;
@ -275,7 +282,7 @@ server {
} }
location ^~ /Microsoft-Server-ActiveSync { 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_connect_timeout 1000;
proxy_next_upstream timeout error; proxy_next_upstream timeout error;
proxy_send_timeout 1000; proxy_send_timeout 1000;
@ -297,7 +304,7 @@ server {
} }
location ^~ /SOGo { 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-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 $http_host; proxy_set_header Host $http_host;
@ -312,7 +319,7 @@ server {
} }
location /SOGo.woa/WebServerResources/ { 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_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
@ -322,7 +329,7 @@ server {
} }
location /.woa/WebServerResources/ { 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_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
@ -332,7 +339,7 @@ server {
} }
location /SOGo/WebServerResources/ { 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_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;
@ -342,7 +349,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://sogo:9192/$1.SOGo/Resources/$2;
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_cache sogo; proxy_cache sogo;
proxy_cache_valid 200 1d; proxy_cache_valid 200 1d;