templates › web-servers › nginx
Nginx Reverse Proxy Template
A reusable, production-minded starter pack for reverse proxying application traffic with explicit timeouts, forwarded headers, compression, and useful logging.
NGINXREVERSE PROXYREUSABLE
What you get
templates/web-servers/nginx/
├── nginx.conf
├── conf.d/
│ └── reverse-proxy.conf
└── snippets/
├── proxy-headers.conf
├── gzip.conf
├── security-headers.conf
└── tls.conf
Design goals
Predictable proxy behavior
Explicit connect, send, and read timeouts.
Useful request context
Forwarded headers preserve client and scheme information.
Operational visibility
Logs include request and upstream response time.
Reusable snippets
Headers, compression, TLS, and security are split cleanly.
Reverse proxy configuration
upstream backend {
least_conn;
server app1:8080 max_fails=3 fail_timeout=10s;
server app2:8080 max_fails=3 fail_timeout=10s;
keepalive 32;
}
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://backend;
proxy_http_version 1.1;
include /etc/nginx/snippets/proxy-headers.conf;
proxy_connect_timeout 5s;
proxy_send_timeout 30s;
proxy_read_timeout 30s;
}
}
Before production use
Adapt, do not blindly paste.
Review TLS, request body limits, buffering, timeouts, security headers, and upstream behavior for your application.
Verification
nginx -t
nginx -T
curl -I http://example.com
curl -v http://example.com
tail -f /var/log/nginx/access.log
tail -f /var/log/nginx/error.log