For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

This setup uses Nginx to provide HTTPS. The connection between Nginx and Drako stays local and uses HTTP.

1

Write down your addresses

Replace dashboard.example.com throughout this guide with your chosen dashboard name.

Detail
Example
What it is for

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.

2

Point your domain to the server

Open the DNS settings at the company that manages your domain.

Create this record:

Field
Value

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 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.com
3

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.

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=direct

When 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

  1. Select the application used by your bot.

  2. Open OAuth2 and find Redirects.

  3. Add https://dashboard.example.com/api/auth/callback, using your own dashboard name.

  4. 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/

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.

4

Install Nginx and allow website traffic

sudo apt update
sudo apt install nginx curl nano
sudo systemctl enable --now nginx

If 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 status

If it says Status: active, add these rules:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

If 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.

5

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.com

If 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;
    }
}

Keep the $host, $scheme, and $remote_addr text exactly as shown. These are Nginx variables, not placeholders for you to fill in.

The headers let Drako recognize the public request correctly. Buffering is disabled so dashboard updates can arrive promptly. These directives are documented in the Nginx proxy reference.

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.com

If it says File exists, check that the existing link points to the intended file; do not delete it blindly.

Check the configuration:

sudo nginx -t

Only if the check succeeds, apply it:

sudo systemctl reload nginx

Open http://dashboard.example.com in your browser. At this stage it should show the Drako dashboard.

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.

6

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 snapd

If you just installed snapd, reconnect your SSH session, then run:

sudo snap install snapd
sudo snap install --classic certbot

If 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 --redirect

Use 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.

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-run

The snap installation schedules renewal automatically. Resolve any dry-run failure before relying on it.

7

Test signing in, saving, and signing out

  1. Open the public HTTPS address in a fresh private browser window.

  2. Sign in with Discord.

  3. Open a server you manage.

  4. Make a small dashboard change you can undo, save it, and confirm it persists after refreshing.

  5. Undo the test change if appropriate.

  6. Sign out, then sign in again.

If these actions work, the setup is complete.

If something still does not work

Problem
Check

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