Production-Ready Nginx Reverse Proxy Configuration
- Category DevOps
- Type Config
- Platform Server
- Language nginx
- Price Free
- Copy 33 876
- Comments 0
Production-Ready Nginx Reverse Proxy Configuration
# Server block to securely handle reverse proxy routing
server {
listen 80;
server_name ://yourdomain.com;
# Redirect all non-secure HTTP traffic to secure HTTPS protocol
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name ://yourdomain.com;
# SSL Certificates (Managed by Let's Encrypt / Certbot)
ssl_certificate /etc/letsencrypt/live/://yourdomain.com;
ssl_certificate_key /etc/letsencrypt/live/://yourdomain.com;
location / {
# Route standard external web requests to local app port
proxy_pass http://127.0.0.1:8080;
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;
}
}
Free snippet — copy & paste!
Copy this snippet for free on Clayi Code. One click — no account required.

There are no comments yet :(