|
map $http_upgrade $type { |
|
default "web"; |
|
websocket "ws"; |
|
} |
|
|
|
server { |
|
root /var/www/domain.com/dist/browser; |
|
index index.html index.htm index.nginx-debian.html; |
|
charset utf-8; |
|
server_name domain.com www.domain.com; |
|
|
|
location / { |
|
try_files $uri $uri/ /index.html; |
|
} |
|
|
|
location /graphql { |
|
proxy_pass http://[droplet-ip]:4000/graphql; |
|
proxy_set_header Host $host; |
|
proxy_read_timeout 60; |
|
proxy_connect_timeout 60; |
|
proxy_redirect off; |
|
|
|
proxy_http_version 1.1; |
|
proxy_set_header Upgrade $http_upgrade; |
|
proxy_set_header Connection 'upgrade'; |
|
proxy_set_header Host $host; |
|
proxy_cache_bypass $http_upgrade; |
|
} |
|
|
|
location /images { |
|
proxy_pass http://[droplet-ip]:4000; |
|
proxy_set_header Host $host; |
|
proxy_read_timeout 60; |
|
proxy_connect_timeout 60; |
|
proxy_redirect off; |
|
|
|
proxy_http_version 1.1; |
|
proxy_set_header Upgrade $http_upgrade; |
|
proxy_set_header Connection 'upgrade'; |
|
proxy_set_header Host $host; |
|
proxy_cache_bypass $http_upgrade; |
|
} |
|
|
|
location @ws { |
|
proxy_pass http://127.0.0.1:6001; |
|
proxy_set_header Host $host; |
|
proxy_read_timeout 60; |
|
proxy_connect_timeout 60; |
|
proxy_redirect off; |
|
|
|
proxy_http_version 1.1; |
|
proxy_set_header Upgrade $http_upgrade; |
|
proxy_set_header Connection 'upgrade'; |
|
proxy_set_header Host $host; |
|
proxy_cache_bypass $http_upgrade; |
|
} |
|
|
|
listen [::]:443 ssl ipv6only=on; # managed by Certbot |
|
listen 443 ssl; # managed by Certbot |
|
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot |
|
ssl_certificate_key /etc/letsencrypt/live/domain.com/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.domain.com) { |
|
return 301 https://$host$request_uri; |
|
} # managed by Certbot |
|
|
|
|
|
if ($host = domain.com) { |
|
return 301 https://$host$request_uri; |
|
} # managed by Certbot |
|
|
|
|
|
listen 80; |
|
listen [::]:80; |
|
server_name domain.com www.domain.com; |
|
return 404; # managed by Certbot |
|
} |