Tutorial5 min read
Deploy Nginx Reverse Proxy with OpenClaw
Use Nginx as a reverse proxy in front of OpenClaw. SSL termination, load balancing, and caching.
Running Nginx in front of OpenClaw adds SSL termination, rate limiting, and caching. This is a production pattern for high-traffic bots.
Docker Compose Setup
# docker-compose.yml
services:
nginx:
image: nginx:alpine
ports:
- "443:443"
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./certs:/etc/nginx/certs
depends_on:
- openclaw
openclaw:
build: .
environment:
- PORT=3000
Nginx Config
server {
listen 443 ssl http2;
server_name yourbot.fly.dev;
ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;
location / {
proxy_pass http://openclaw:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache_bypass $http_upgrade;
}
location /health {
proxy_pass http://openclaw:3000/health;
access_log off;
}
}
Fly.io Deployment
On Fly.io, Fly handles SSL termination automatically. Use Nginx only if you need specific proxy features not available on Fly.io.