gear-complex-codeNginx Configuration

circle-info

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.

circle-exclamation

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;
	}
}
circle-exclamation

For production, use HTTPS with a valid certificate.


AthenaBot Config Values When Using Nginx

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

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:

triangle-exclamation

Enable and Test

After saving your Nginx file:

  1. Test syntax:

  1. Reload Nginx:

  1. 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:

  1. 502 Bad Gateway

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

    • proxy_pass points to the wrong host/port.

  2. fetch failed or API errors

    • web_api_base_url does not match your API subdomain.

    • Web API authentication_key is invalid/default.

  3. OAuth redirect loop or login failure

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

  4. Cloudflare / reverse proxy rate-limit issues

    • Set Web API rate_limit.proxied to true.

    • Keep only trusted proxy paths publicly exposed.

Last updated