Sharkord
HTTPS Setup

Nginx

Nginx as the reverse proxy, with certbot.

sudo apt install -y nginx certbot python3-certbot-nginx

/etc/nginx/sites-available/sharkord:

server {
    listen 80;
    server_name sharkord.example.com;

    # uploads stream through, so no size cap or buffering
    client_max_body_size 0;
    proxy_request_buffering off;

    location / {
        proxy_pass http://127.0.0.1:4991;
        proxy_http_version 1.1;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # the websocket is long lived, the default 60s drops it
        proxy_read_timeout 86400;
        proxy_send_timeout 86400;
    }
}
sudo ln -s /etc/nginx/sites-available/sharkord /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d sharkord.example.com

Without client_max_body_size 0, every upload over 1 MB fails with 413.

Firewall

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 40000/tcp
sudo ufw allow 40000/udp

Keep 4991 closed. Nginx reaches it on localhost.

On this page