An Nginx config builder that generates a complete, valid server block for the most common setups: serving static files, acting as a reverse proxy, terminating SSL, or all three. Toggle gzip, security headers, and rate limiting and copy a config you can drop straight into Nginx.
How it works
The tool assembles a standard Nginx server { ... } block from your choices. In static
mode it sets a root, an index, and a try_files $uri $uri/ =404; rule. In reverse
proxy mode it emits a proxy_pass to your upstream along with the four headers Nginx
should forward — Host, X-Real-IP, X-Forwarded-For, and X-Forwarded-Proto — plus
proxy_http_version 1.1.
When SSL is enabled it generates two server blocks: one on port 80 that issues a
301 https://$host$request_uri redirect, and the main block on port 443 with ssl on,
modern protocols (TLSv1.2 TLSv1.3), and Let’s Encrypt certificate paths. Security
headers add X-Frame-Options, X-Content-Type-Options: nosniff, a referrer policy, and
HSTS when SSL is on. Rate limiting declares a limit_req_zone and applies
limit_req zone=reqlimit burst=20 nodelay; inside the location.
Tips and notes
- The
limit_req_zonedirective must sit in the http context (the top ofnginx.conf), not inside the server block — the generated comment marks it for you. - Replace the Let’s Encrypt certificate paths if you manage certificates differently; the domain in those paths is filled from your server name.
- Never long-cache
index.html; for hashed static assets you can add a separatelocationwithexpires 1y;andCache-Control: immutable. - Always validate before reloading:
nginx -tchecks syntax, thennginx -s reloadapplies the change with zero downtime.