Repository navigation
Expand file tree
/
Copy pathnginx.conf
More file actions
42 lines (37 loc) · 1.58 KB
/
Copy pathnginx.conf
File metadata and controls
42 lines (37 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# nginx in front of figcraft-server; setup in docs/server.md ("Deploy on a Linux server").
# Put this in /etc/nginx/conf.d/figcraft.conf (it goes inside nginx's http block), replace the
# host name and the certificate paths (these are certbot's), then `sudo nginx -t` and
# `sudo systemctl reload nginx`.
# WebSocket upgrades: forward the client's Upgrade header and ask for the upgrade only then.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name figcraft.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name figcraft.example.com;
ssl_certificate /etc/letsencrypt/live/figcraft.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/figcraft.example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
# Under a path instead: `location /figcraft/ { ... }` with the same lines, and
# public_url = "wss://figcraft.example.com/figcraft/".
location / {
proxy_pass http://127.0.0.1:47900;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
# Who the client is, for per-address limits and blocks (trusted_proxy = "127.0.0.1").
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Apps ping every 15 seconds and the server drops a connection idle for 45: stay above both.
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
}