# {{ ansible_managed }} server { server_name chat.{{ domain_name }} www.chat.{{ domain_name }}; location /january/ { proxy_pass http://10.0.0.6:42599/; proxy_set_header Host $host; proxy_set_header Connection $http_connection; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; add_header 'Content-Security-Policy' 'upgrade-insecure-requests'; } location /autumn/ { proxy_pass http://10.0.0.6:6119/; proxy_set_header Host $host; proxy_set_header Connection $http_connection; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; add_header 'Content-Security-Policy' 'upgrade-insecure-requests'; } location /vortex/ { proxy_pass http://10.0.0.6:34902/; proxy_set_header Host $host; proxy_set_header Connection $http_connection; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; add_header 'Content-Security-Policy' 'upgrade-insecure-requests'; } # /wsvortex is to be evaluated first before /ws location /wsvortex { proxy_pass http://10.0.0.6:34902/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; # Important, to prevent ws from sending data for a long time and causing timeout disconnection. proxy_read_timeout 24h; proxy_set_header Host $host; proxy_set_header Connection $http_connection; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; add_header 'Content-Security-Policy' 'upgrade-insecure-requests'; } location /ws { proxy_pass http://10.0.0.6:60160/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; # Important, to prevent ws from sending data for a long time and causing timeout disconnection. proxy_read_timeout 24h; proxy_set_header Host $host; proxy_set_header Connection $http_connection; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; add_header 'Content-Security-Policy' 'upgrade-insecure-requests'; } location /api/ { proxy_pass http://10.0.0.6:27271/; proxy_set_header Host $host; proxy_set_header Connection $http_connection; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; add_header 'Content-Security-Policy' 'upgrade-insecure-requests'; } location / { proxy_pass http://10.0.0.6:53244; proxy_set_header Host $host; proxy_set_header Connection $http_connection; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; add_header 'Content-Security-Policy' 'upgrade-insecure-requests'; } listen 443 ssl http2; # managed by Certbot ssl_certificate /etc/letsencrypt/live/chat.{{ domain_name }}/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/chat.{{ domain_name }}/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = www.chat.{{ domain_name }}) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = chat.{{ domain_name }}) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; server_name chat.{{ domain_name }} www.chat.{{ domain_name }}; return 404; # managed by Certbot }