Repository navigation
Nginx Guide
Nginx puts the admin panel on your own domain. Two setups are ready in the source repository under website/deploy/nginx/.
| You have | Use |
|---|---|
| A domain name pointing to this server |
nationdex-panel.conf (HTTPS, with Let's Encrypt) |
| A LAN address, a VPN, or TLS handled by something else |
nationdex-panel.http.conf (plain HTTP) |
You do not need Nginx to use the panel. The bot serves it on port 3000 itself.
- Nginx installed (
sudo apt install nginxon Debian or Ubuntu). - A domain, for example
panel.yourdomain.com, with anArecord pointing to the server's public IP. - Ports
80and443open on your router or firewall. - The source file
website/deploy/nginx/nationdex-panel.conf. Get it from the repository, or copy the file from GitHub.
-
In
.envsetPANEL_HOST=127.0.0.1, so only Nginx reaches the panel. Restart the bot. -
Install certbot and get a certificate. Replace the domain:
sudo apt install certbot sudo mkdir -p /var/www/certbot sudo certbot certonly --webroot -w /var/www/certbot -d panel.yourdomain.com
The certificate ends up in
/etc/letsencrypt/live/panel.yourdomain.com/. -
Copy the config and change the domain in three places (
server_nametwice, and the certificate paths):sudo cp website/deploy/nginx/nationdex-panel.conf /etc/nginx/conf.d/nationdex-panel.conf sudo nano /etc/nginx/conf.d/nationdex-panel.conf
-
Test and reload:
sudo nginx -t && sudo systemctl reload nginx -
Open
https://panel.yourdomain.com.
The file also sets HSTS, rate-limits the sign-in form to 10 tries a minute per address, and allows 25 MB uploads (nation art and card backgrounds). The panel adds its own security headers, so Nginx does not repeat them.
Note: http2 on; needs Nginx 1.25.1 or newer. On older versions use listen 443 ssl http2; and delete that line.
Renewal is automatic with certbot's timer. Check with sudo certbot renew --dry-run.
sudo cp website/deploy/nginx/nationdex-panel.http.conf /etc/nginx/conf.d/nationdex-panel.conf
sudo nginx -t && sudo systemctl reload nginxSet PANEL_HOST=127.0.0.1 in .env and restart the bot. Use this only on a network you trust. Passwords travel unencrypted over plain HTTP.
| Symptom | Fix |
|---|---|
502 Bad Gateway |
The bot is not running, or PANEL_PORT does not match 127.0.0.1:3000 in the upstream block |
nginx: [emerg] ... bind() ... failed |
Another program uses port 80 or 443 |
Certificate errors in browser |
The certificate path in the config does not match the certbot domain |
Sign-in keeps failing with 429
|
Rate limit reached: wait a minute |
Panel says the cookie is not Secure
|
Make sure proxy_set_header X-Forwarded-Proto $scheme; is present in the location block |
For the bot itself (not the panel), do not publish port 2222 through Nginx. Keep it local.