49 lines
1.6 KiB
Plaintext
49 lines
1.6 KiB
Plaintext
# Install in an nginx http-context include (e.g. sites-enabled).
|
|
# Replace game.example.com and certificate paths before enabling.
|
|
map $http_upgrade $dragon_ball_connection {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
limit_req_zone $binary_remote_addr zone=dragon_ball_signal:10m rate=10r/s;
|
|
|
|
server {
|
|
listen 80;
|
|
server_name game.example.com;
|
|
return 301 https://game.example.com$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
server_name game.example.com;
|
|
ssl_certificate /etc/letsencrypt/live/game.example.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/game.example.com/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
client_max_body_size 16k;
|
|
access_log off;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:2100;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
# Internet-facing nginx on the app host; discard client-supplied forwarding.
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Connection "";
|
|
}
|
|
|
|
location /socket.io/ {
|
|
limit_req zone=dragon_ball_signal burst=40 nodelay;
|
|
limit_req_status 429;
|
|
proxy_pass http://127.0.0.1:2100;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $dragon_ball_connection;
|
|
proxy_read_timeout 75s;
|
|
proxy_send_timeout 75s;
|
|
proxy_buffering off;
|
|
}
|
|
}
|