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

How to using nginx reverse proxy ssl guide

Securely expose your vLLM API, Open WebUI, AnythingLLM, or n8n to the internet with HTTPS. Uses nginx + Let's Encrypt (free SSL certificates).

Prerequisite: A domain name pointing to your server's public IP.


1. Why Use a Reverse Proxy?

Benefit
Description

HTTPS/SSL

Encrypt traffic; required for production

Clean URLs

https://api.yourdomain.com instead of http://ip:8000

Single entry point

Route multiple services through one domain

Security

Hide internal ports, add rate limiting, access control

Streaming support

Proper SSE/streaming for LLM token output

Services & Default Ports

Service
Internal Port
Suggested Subdomain

vLLM API

8000

api.yourdomain.com

Open WebUI

3000

chat.yourdomain.com

AnythingLLM

3001

docs.yourdomain.com

n8n

5678

n8n.yourdomain.com


2. DNS Setup

Point your domain(s) to the server's public IP. Create A records:

Verify DNS propagation:


3. Install nginx + Certbot

Verify nginx is running:


4. Reverse Proxy Configs

Create a config per service. The vLLM API config includes streaming support (critical for token-by-token output).

Enable Configs


5. Enable SSL with Let's Encrypt

Certbot automatically obtains certificates and modifies your nginx configs to use HTTPS.

Follow the prompts:

  • Enter email (for renewal notices)

  • Agree to terms

  • Choose redirect HTTP → HTTPS (recommended)

Auto-Renewal

Certbot installs a renewal timer automatically. Verify:

Certificates renew automatically before expiry (90-day certs, renewed at ~60 days).

Verify HTTPS


6. Securing the API

Exposing an LLM API publicly invites abuse. Add these protections.

6.1 API Key (vLLM built-in)

Ensure vLLM runs with --api-key:

Clients must send: Authorization: Bearer sk-your-strong-secret-key

6.2 Rate Limiting (nginx)

Add to the top of /etc/nginx/nginx.conf inside the http {} block:

Then in the vLLM API location / block:

6.3 IP Allowlist (Optional)

Restrict API access to specific IPs:

6.4 Basic Auth (extra layer)

In the location block:


7. Troubleshooting

Certbot fails — "Could not connect"
  • DNS not propagated yet: dig +short api.yourdomain.com

  • Port 80 blocked: sudo ufw allow 'Nginx Full'

  • nginx not running: sudo systemctl start nginx

502 Bad Gateway
  • Backend service not running: docker compose ps

  • Wrong port in proxy_pass: verify service port

  • Test backend directly: curl http://127.0.0.1:8000/v1/models

Streaming/SSE not working (responses arrive all at once)
  • Ensure proxy_buffering off; is set in the API config

  • Confirm proxy_http_version 1.1;

"413 Request Entity Too Large"
  • Increase client_max_body_size in the relevant config

WebSocket errors (Open WebUI / n8n)
  • Ensure proxy_set_header Upgrade $http_upgrade; and Connection "upgrade"; are present

Certificate renewal issues

Quick Reference

Was this helpful?