Cheat Sheet
The commands you keep forgetting, with a one-line description and a real example you can copy - 629 across 38 tools. Pick a tool in the sidebar, or search across all of them.
nginx
Test, reload, and read the config blocks behind most reverse proxies.| Command | What it does | Example |
|---|---|---|
nginx -t | Validate the config BEFORE reloading - always. | sudo nginx -t |
nginx -s reload | Apply config changes without dropping connections. | sudo nginx -s reload |
nginx -T | Dump the full merged config (find what is really in effect). | sudo nginx -T | grep -n server_name |
config layout | Main config + one file per site, enabled by symlink. | ls /etc/nginx/sites-available /etc/nginx/sites-enabled |
server block | One virtual host: port, domain, root. | server {
listen 80;
server_name example.com;
root /var/www/site;
} |
location | Route a URL prefix inside a server block. | location /api/ {
proxy_pass http://127.0.0.1:3000;
} |
proxy_pass | Forward requests to an app server (reverse proxy). | proxy_pass http://127.0.0.1:3000; |
proxy headers | Pass the real client host/IP to the app. | proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; |
try_files (SPA) | Serve files, fall back to index.html for client routing. | try_files $uri $uri/ /index.html; |
redirect to https | The standard port-80 to-https bounce. | return 301 https://$host$request_uri; |
https with certbot | Free TLS certificate, auto-configured. | sudo certbot --nginx -d example.com |
gzip | Compress text responses. | gzip on;
gzip_types text/css application/json application/javascript; |
client_max_body_size | Raise the upload limit (default is 1m). | client_max_body_size 50m; |
access log | Watch requests as they arrive. | sudo tail -f /var/log/nginx/access.log |
error log | The first place to look when something 502s. | sudo tail -f /var/log/nginx/error.log |
add a header | Attach a response header (e.g. cache policy). | add_header Cache-Control "public, max-age=3600"; |