Skip to main content

Nginx Cheatsheets

Eight comprehensive quick-reference cards. Open one in a tmux pane beside your work session.

Fast Search
# Search all cheatsheets from CLI
grep -r "proxy_pass" /path/to/docs/server/web-server/Nginx/11-cheatsheets/

Cheatsheets in This Module

CheatsheetWhat It Covers
CLI Quick ReferenceService control, config test, signals, logs, site management
Config Syntax Referencenginx.conf, server blocks, location blocks, directives
Server Block SetupFull workflow for adding new sites from CLI
PHP-FPM TuningPool config, socket, php.ini, OPcache
Security HardeningTLS, headers, IP access, rate limiting
Performance TuningHTTP/2, gzip, caching, worker tuning
Troubleshooting MatrixErrors → root cause → exact CLI fix
Automation & Bash ScriptsScripts, cron, opencode AI workflows

Core Paths — Always Know These

/etc/nginx/
├── nginx.conf # Main config
├── conf.d/*.conf # Site configs (auto-loaded)
├── sites-available/ # All sites
├── sites-enabled/ # Active sites (symlinks)
└── snippets/ # Reusable fragments

/var/log/nginx/
├── access.log # All requests
└── error.log # Errors — check FIRST

/run/nginx.pid # Master PID
/run/php/php8.4-fpm.sock # PHP-FPM socket (Debian)

60-Second Emergency Commands

# Service alive?
sudo systemctl status nginx

# What broke?
sudo tail -30 /var/log/nginx/error.log

# Test config
sudo nginx -t

# Apply changes (no downtime)
sudo nginx -s reload

# Test a site
curl -I http://localhost/
curl -H "Host: example.com" -I http://localhost/

# PHP-FPM OK?
sudo systemctl status php8.4-fpm
ps aux | grep php-fpm | grep -v grep | wc -l

# What's listening?
sudo ss -tlnp | grep nginx