diff --git a/Nginx/default.tpl.conf b/Nginx/default.tpl.conf index 9c2d413bf6..2e350dfcef 100644 --- a/Nginx/default.tpl.conf +++ b/Nginx/default.tpl.conf @@ -34,9 +34,41 @@ upstream mail { server mail:3190 weight=10 max_fails=3 fail_timeout=30s; } + server { listen 80 default_server; + + server_name _; # All domains. + + proxy_busy_buffers_size 512k; + proxy_buffers 4 512k; + proxy_buffer_size 256k; + + fastcgi_buffers 16 16k; + fastcgi_buffer_size 32k; + + location / { + return 301 https://$host$request_uri; + } + + location /status-page { + return 301 https://$host$request_uri; + } + + location /status-page-api { + proxy_pass http://dashboard-api/api/status-page/status-page-api; + } + + # Acme Verification. + location /.well-known { + proxy_pass http://dashboard-api/api/status-page/.well-known; + } + +} + +server { + listen 443 default_server ssl; # Port HTTPS @@ -82,36 +114,6 @@ server { proxy_pass http://status-page; } - - location /status-page-api { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - # enable WebSockets (for ws://sockjs not connected error in the accounts source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon) - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - - proxy_pass http://dashboard-api/api/status-page/status-page-api; - } - - # Acme Verification. - location /.well-known { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - # enable WebSockets (for ws://sockjs not connected error in the accounts source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon) - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - - proxy_pass http://dashboard-api/api/status-page/.well-known; - } - } server {