My App
Getting Started

Nginx Configuration

Configure Nginx as a reverse proxy for the AthenaBot dashboard and Web API.

This page assumes your AthenaBot Dashboard and Web API are already configured and working on local ports.

If you have not finished that yet, complete the Dashboard Setup guide first.

Before You Start

Make sure you know these values before editing Nginx:

  • Dashboard domain (example: panel.example.com)
  • Web API domain (example: api.example.com)
  • Dashboard local URL (example: http://127.0.0.1:3222)
  • Web API local URL (example: http://127.0.0.1:3111)

Using two subdomains is recommended when transcripts and API routes are served together.

Use different ports for Dashboard and Web API. Do not expose those internal ports directly to the public internet when using Nginx as a reverse proxy.


HTTP-Only Configuration (Testing)

Use this only for local testing or private networks.

Create a site file in Nginx (for example /etc/nginx/sites-available/athena-dashboard) and add:

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

	# Dashboard frontend + dashboard API
	location / {
		proxy_pass http://127.0.0.1:3222;
		proxy_http_version 1.1;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
	}
}

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

	# AthenaBot Web API + transcripts
	location / {
		proxy_pass http://127.0.0.1:3111;
		proxy_http_version 1.1;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
	}
}

This is a testing-only setup. For production, use HTTPS on both subdomains.


For production, use HTTPS with a valid certificate.

server {
	listen 80;
	server_name panel.example.com;
	return 301 https://$host$request_uri;
}

server {
	listen 80;
	server_name api.example.com;
	return 301 https://$host$request_uri;
}

server {
	listen 443 ssl http2;
	server_name panel.example.com;

	ssl_certificate /etc/letsencrypt/live/panel.example.com/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/panel.example.com/privkey.pem;

	# Dashboard frontend + dashboard API
	location / {
		proxy_pass http://127.0.0.1:3222;
		proxy_http_version 1.1;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
	}
}

server {
	listen 443 ssl http2;
	server_name api.example.com;

	ssl_certificate /etc/letsencrypt/live/api.example.com/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/api.example.com/privkey.pem;

	# AthenaBot Web API + transcripts
	location / {
		proxy_pass http://127.0.0.1:3111;
		proxy_http_version 1.1;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
	}
}

AthenaBot Config Values When Using Nginx

Set your Dashboard and Web API URLs in common.json to public-facing values:

"dashboard_base_url": "https://panel.example.com",
"web_api_base_url": "https://api.example.com"

In your Web API config (web_api.json(5)), set base_ip to your API domain (example: api.example.com).

In Discord Developer Portal OAuth2 redirects, use:

https://panel.example.com/api/auth/callback

The redirect URL must match exactly, including protocol (http or https), domain, and path.


Enable and Test

After saving your Nginx file:

  • Test syntax:
sudo nginx -t
  • Reload Nginx:
sudo systemctl reload nginx
  • Start AthenaBot and test:

  • Open https://panel.example.com

  • Confirm dashboard login works

  • Confirm data loads without fetch failed


Common Problems

If the dashboard does not load correctly:

  • 502 Bad Gateway

Dashboard or Web API is not running on the target local port.

  • proxy_pass points to the wrong host/port.

  • fetch failed or API errors

web_api_base_url does not match your API subdomain.

  • Web API authentication_key is invalid/default.

  • OAuth redirect loop or login failure

Redirect URL in Discord Developer Portal does not exactly match the active dashboard URL.

  • Cloudflare / reverse proxy rate-limit issues

Set Web API rate_limit.proxied to true.

  • Keep only trusted proxy paths publicly exposed.

On this page