upstream delphi-dev-backend { server 127.0.0.1:4322; } upstream delphi-dev-frontend { server 127.0.0.1:4323; } map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { server_name dev1.delphi.market; listen 80; listen [::]:80; return 301 https://dev1.delphi.market$request_uri; } server { server_name dev1.delphi.market; listen 443; listen [::]:443; ssl on; ssl_certificate /etc/letsencrypt/live/dev1.delphi.market/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/dev1.delphi.market/privkey.pem; location / { proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Prefix /; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_pass http://delphi-dev-frontend$request_uri; } location /api { proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Prefix /; proxy_pass http://delphi-dev-backend$request_uri; } location /hotreload { root /var/www/dev1.delphi; } include letsencrypt.conf; }