Tool cheatsheet
Nginx 1 Cheatsheet
Control Nginx, test and reload configuration, and the config snippets for proxies, TLS, static sites and caching.
Control and diagnostics
- Check the Nginx version — Print the version. Use -V to include the build options and modules.
- Test the configuration — Check the syntax of the configuration files. Always run this before reloading.
- Reload without downtime — Apply a new configuration gracefully.
- Reload with systemd — Reload the service on systems that use systemd.
- Restart Nginx — Stop and start the service, dropping open connections.
- Print the full configuration — Test and dump the merged configuration, including all includes.
- Follow the error log — Watch errors as they happen.
- Follow the access log — Watch requests as they arrive.
Servers and static files
- Serve a static site — A server block that serves files from a folder.
- Serve a single-page app — Send unknown paths to index.html so client-side routing works.
- Enable a site on Debian or Ubuntu — Link a file from sites-available to sites-enabled, then test and reload.
- Cache static assets — Tell browsers to cache images, scripts and styles for 30 days.
- Enable gzip compression — Compress text responses to save bandwidth.
- Allow larger uploads — Raise the request body limit, which defaults to 1 MB.
Reverse proxy and TLS
- Proxy to an app — Forward requests to an app on port 3000 and pass the original host and client address.
- Proxy WebSockets — Pass the upgrade headers so WebSocket connections work through the proxy.
- Redirect HTTP to HTTPS — Send every plain HTTP request to the HTTPS version of the same URL.
- Get a free TLS certificate — Request a Let's Encrypt certificate and let Certbot edit the Nginx config.
- Test certificate renewal — Check that automatic renewal will work, without issuing a certificate.
- Configure a TLS server — Listen on 443 with HTTP/2 and your certificate.
- Rate-limit requests — Allow 10 requests per second per client IP, with a small burst.
- Password-protect a location — Require a username and password from an htpasswd file.
Related cheatsheets
- Ansible 2 cheatsheet — Run ad-hoc commands and playbooks, manage inventories, roles, collections and secrets with Ansible.
- Argo CD 3 cheatsheet — Install Argo CD, define Applications declaratively, and manage sync, diffs, history and rollbacks with the argocd CLI.
- AWS CLI 2 cheatsheet — Configure credentials and manage S3, EC2, Lambda, logs, containers and secrets with the AWS CLI v2.
- Azure CLI 2 cheatsheet — Sign in and manage resource groups, VMs, web apps, storage, Kubernetes, registries and secrets with the az command.
- Bash and Linux 5 cheatsheet — Everyday shell and Linux commands for files, searching text, permissions, processes and servers.
- Claude API cheatsheet — Call Claude from Python, TypeScript or curl: messages, streaming, thinking, tools, structured output, caching, batches and error handling.