Nginx Step By Step
This guide gives your Drako Bot v2 dashboard a secure website address, such as https://dashboard.example.com.
Follow each step in order. Check the result before moving to the next step.
Before you start
This guide is for a bot running directly on an Ubuntu or Debian server, with Nginx installed on that same server. You need administrator access through SSH, a domain you control, and the dashboard addon already installed and configured.
If you connect from Windows, run the Linux commands in your server's SSH terminal, not in your computer's normal PowerShell window.
Bot inside Pelican or Docker? Start with the Pelican and Docker guide.
Want Cloudflare Tunnel instead? Use the Cloudflare Tunnel guide.
Addon not configured yet? Complete Dashboard Setup first.
Write down your addresses
Replace dashboard.example.com throughout this guide with your chosen dashboard name.
Dashboard name
dashboard.example.com
DNS and Nginx
Public website address
https://dashboard.example.com
Drako's URL and your browser
Server's public IPv4 address
Get this from your hosting provider
Your DNS record
Drako dashboard port
3000
Drako and Nginx's local connection
Local dashboard address
http://127.0.0.1:3000
Nginx connects here
Find the port in the existing Dashboard section of config/core.yml, or in DASHBOARD_PORT if you use .env.
If your dashboard port is 3016, replace 3000 with 3016 in the Drako settings, local checks, and Nginx configuration below. Keep the website address without a port number.
127.0.0.1 means “this server.” Keep it as shown when Nginx and Drako both run directly on this server.
Point your domain to the server
Open the DNS settings at the company that manages your domain.
Create this record:
Type
A
Name or Host
dashboard
Value or Target
Your server's public IPv4 address
TTL
Automatic or the default
Some providers expect the full name, dashboard.example.com, in the Name field. Follow the example shown in their interface.
If you use Cloudflare for DNS, set this record to DNS only with the grey cloud for this guide. Do not create a tunnel route for the same hostname.
If a record for this exact name already exists, check what it serves before changing it. This guide uses IPv4. If the hostname also has an AAAA record, ask the administrator to configure Nginx for IPv6 too or remove that hostname's unused IPv6 record. An old IPv6 record can send visitors to the wrong server.
In the server's SSH terminal, check the address:
getent ahostsv4 dashboard.example.comReady to continue: the returned IPv4 address matches your server. DNS changes may take time to appear.
Set up Drako's public address
Back up the bot's settings file. Edit the settings source your bot actually uses.
If you use config/core.yml
Find the existing Dashboard: section and update these fields. Keep your existing license and credentials in that section.
Dashboard:
Enabled: true
URL: "https://dashboard.example.com"
Port: 3000
Hosting: "direct"
# Keep your existing license and Discord credentials.Ensure that you don't include trailing slashes in the URL. It should match your exact domain, such as dashboard.example.com
If you use .env or hosting environment variables
Update these values in your active .env file or hosting startup settings:
DASHBOARD_ENABLED=true
DASHBOARD_URL=https://dashboard.example.com
DASHBOARD_PORT=3000
DASHBOARD_HOSTING=directWhen Drako loads a .env file, these startup settings come from that file instead of the YAML section. Hosting environment variables can override the file. Keep existing credentials.
Hosting: "direct" means Drako is installed directly on this Windows/Linux machine. With an HTTPS URL, it chooses the local listening and proxy defaults for this guide. The bot generates and saves its session secret automatically; keep any secret it has already saved.
If you previously added advanced listening or proxy settings, they still override these defaults. See Existing advanced settings below if you are changing your hosting setup.
Update the Discord return address
Open the Discord Developer Portal.
Select the application used by your bot.
Open OAuth2 and find Redirects.
Add
https://dashboard.example.com/api/auth/callback, using your own dashboard name.Save the changes.
If your bot already has RedirectURI or DASHBOARD_REDIRECTURI set, update that setting to the same address.
Save your settings and restart Drako using your usual bot manager. Do not start a second copy of the bot.
In the server's SSH terminal, run the following check. If curl is missing, install it first with sudo apt update followed by sudo apt install curl.
curl -I http://127.0.0.1:3000/Ready to continue: the response includes 200 and a Content-Type containing text/html.
If it says Connection refused, check the bot's startup log, enabled setting, and port. If it says 426 Upgrade Required, investigate the service listening on that port before continuing. A public HTTPS URL does not make Drako's local listener use HTTPS.
Install Nginx and allow website traffic
Run on the server through SSH. Enter one command at a time:
sudo apt update
sudo apt install nginx curl nano
sudo systemctl enable --now nginxIf another web server already uses ports 80 or 443, have the server administrator add this dashboard to the existing setup. Do not stop unrelated websites to free the ports.
In your hosting provider's firewall, allow incoming TCP 80 and TCP 443. Keep existing SSH access allowed.
Check whether Ubuntu's UFW firewall is active:
sudo ufw statusIf it says Status: active, add these rules:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcpIf UFW is inactive or not installed, do not enable it as part of this guide. Check any other firewall your server uses with your hosting provider.
The local Drako port, such as 3000, does not need a public inbound rule for this setup.
Add the dashboard to Nginx
Create a separate file for this website. Replace the example domain in the filename too:
sudo nano /etc/nginx/sites-available/dashboard.example.comIf the file already contains a website configuration, back it up and review it before editing.
Paste this configuration. Change dashboard.example.com and, if needed, port 3000:
server {
listen 80;
server_name dashboard.example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Connection "";
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 300s;
}
}Save in Nano: press Ctrl + O, press Enter, then press Ctrl + X.
Enable this website:
sudo ln -s /etc/nginx/sites-available/dashboard.example.com /etc/nginx/sites-enabled/dashboard.example.comIf it says File exists, check that the existing link points to the intended file; do not delete it blindly.
Check the configuration:
sudo nginx -tOnly if the check succeeds, apply it:
sudo systemctl reload nginxOpen http://dashboard.example.com in your browser. At this stage it should show the Drako dashboard.
Wait until HTTPS is working before signing in.
If you see the Nginx welcome page, check server_name, DNS, and whether you enabled and reloaded the correct file. For 502 Bad Gateway, repeat the local test in Step 3.
Turn on HTTPS
The following uses Certbot's snap installation. If Certbot already manages certificates on this server, use that existing installation and skip installing another copy. For a different installation method or a server without snap support, follow the official Certbot instructions.
For a fresh installation:
sudo apt install snapdIf you just installed snapd, reconnect your SSH session, then run:
sudo snap install snapd
sudo snap install --classic certbotIf snap reports an installation or system-support error, complete the snap setup instructions before continuing.
Request the certificate:
sudo /snap/bin/certbot --nginx -d dashboard.example.com --redirectUse your own domain. Follow the prompts for your email and the service terms. An existing non-snap installation normally uses sudo certbot instead of sudo /snap/bin/certbot.
Certbot updates the Nginx file to enable HTTPS and redirect HTTP visitors. Do not paste the original Step 5 configuration over the updated file afterward.
The certificate check needs your domain to reach this server on port 80. If it fails, check DNS, any AAAA record, and both provider and server firewalls. Let's Encrypt HTTP validation.
Check Nginx and certificate renewal:
sudo nginx -t
sudo /snap/bin/certbot renew --dry-runThe snap installation schedules renewal automatically. Resolve any dry-run failure before relying on it.
Ready to continue: https://dashboard.example.com opens without a certificate warning, and opening the HTTP address takes you to HTTPS.
Test signing in, saving, and signing out
Open the public HTTPS address in a fresh private browser window.
Sign in with Discord.
Open a server you manage.
Make a small dashboard change you can undo, save it, and confirm it persists after refreshing.
Undo the test change if appropriate.
Sign out, then sign in again.
If these actions work, the setup is complete.
If something still does not work
502 Bad Gateway
Drako is running; its port matches proxy_pass; the local HTTP test returns dashboard HTML.
426 Upgrade Required
Confirm which process owns the configured port. This response alone does not establish a certificate problem.
Discord redirect error
The Discord redirect and any explicit Drako redirect setting exactly match the public HTTPS callback.
Login returns to the login page
Check Hosting: "direct", Nginx's X-Forwarded-Proto line, and the active settings source.
“This session could not verify the request”
The browser's origin must match Drako's HTTPS URL. Restart after configuration changes, then test a fresh private window.
Works until the terminal closes
Run Drako through your normal persistent process manager; Nginx does not keep the bot running.
If Nginx is in another container or on another server, use the Pelican and Docker guide for the correct destination and proxy trust settings. This page's loopback settings assume both programs run directly on the same machine.
Existing advanced settings
Older guides may have asked you to add Host, TrustLoopbackProxy, or TrustedProxies. Their .env equivalents are DASHBOARD_HOST, DASHBOARD_TRUSTLOOPBACKPROXY, and DASHBOARD_TRUSTEDPROXIES.
For the exact setup on this page, back up your configuration and remove those old overrides so Hosting: "direct" can choose the defaults. Keep custom settings if your host requires them; ask the host before changing a setup that differs from this guide.
When asking for support, include the public dashboard address, dashboard port, local HTTP test result, relevant startup error, and Nginx site configuration. Remove credentials, cookies, tokens, license keys, and session secrets before sharing.
Last updated