Nginx Configuration
This guide explains how to configure Nginx as a reverse proxy for MCPHub, including SSL termination, load balancing, and caching strategies.Basic Reverse Proxy Setup
Configuration File
Create or update your Nginx configuration file (/etc/nginx/sites-available/mcphub
):
Enable the Configuration
Load Balancing Configuration
For high-availability setups with multiple MCPHub instances:Caching Configuration
Browser Caching
Nginx Proxy Cache
Add to thehttp
block in nginx.conf
:
WebSocket Support
For real-time features and SSE (Server-Sent Events):Security Configuration
Rate Limiting
IP Whitelisting
Monitoring and Logging
Access Logs
Status Page
Docker Integration
When running MCPHub in Docker, update the proxy configuration:Complete Example Configuration
Here’s a production-ready example using the providednginx.conf.example
:
Troubleshooting
Common Issues
502 Bad Gateway: Check if MCPHub is running and accessible 504 Gateway Timeout: Increaseproxy_read_timeout
for long-running operations
WebSocket connection failures: Ensure proper Upgrade
and Connection
headers
Cache issues: Clear proxy cache or disable for development