Nginx34 commands
Nginx Cheat Sheet
Essential Nginx commands and config patterns — virtual hosts, reverse proxy, SSL, load balancing, and troubleshooting.
Service Management
| Command | Description |
|---|---|
| Start Nginx |
| Stop Nginx |
| Restart Nginx |
| Reload config without downtime |
| Check service status |
| Test config syntax |
| Test and dump full config |
Reverse Proxy
| Command | Description |
|---|---|
| Forward requests to backend |
| Pass original Host header |
| Pass client IP |
| Forward chain of IPs |
| Pass protocol (http/https) |
| Set backend read timeout |
SSL / TLS
| Command | Description |
|---|---|
| Get Let's Encrypt SSL cert |
| Test cert renewal |
| Set SSL certificate |
| Set SSL private key |
| Restrict TLS versions |
| Enable HSTS |
Load Balancing
| Command | Description |
|---|---|
| Define upstream group |
| Least connections strategy |
| Sticky sessions by IP |
| Weighted load balancing |
| Health check params |
Logs & Debugging
| Command | Description |
|---|---|
| Follow access logs |
| Follow error logs |
| Custom access log path |
| Custom error log with level |
| Check response headers |
Common Directives
| Command | Description |
|---|---|
| Set max upload size |
| Enable gzip compression |
| Set cache headers |
| Redirect HTTP to HTTPS |
| SPA fallback routing |