A fast, offline nginx directive lookup
nginx is configured entirely through directives, and each one is only valid in certain blocks. This reference lets you search by directive name, module or description and filter by the context where it applies, so you can wire up a reverse proxy, static host or rewrite rule without digging through the manual. It runs locally in your browser; no configuration is sent anywhere.
How it works
Every entry shows the directive name, the source module (e.g.
ngx_http_proxy), the syntax with placeholders, the contexts in which the
directive is valid, and the default value where one exists. nginx evaluates
configuration as nested blocks: main -> events/http -> server ->
location. Inner blocks inherit values from their parents and may override
them. A minimal reverse proxy looks like:
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
}
}
After editing, validate with nginx -t and apply with nginx -s reload.
Tips and examples
- Use
try_files $uri $uri/ /index.html;to serve a single-page app and fall back to the app shell for client-side routes. return 301 https://$host$request_uri;in a port-80 server block forces all traffic to HTTPS.- Set
client_max_body_sizehigher than the default1mwhen accepting file uploads, or large requests fail with a413. add_header ... alwaysensures the header is also sent on error responses, which matters for security headers like HSTS.