Nginx Config Builder

Generate an nginx.conf for proxying, static serving, or SSL termination

Build a complete Nginx server block with static-file or reverse-proxy location rules, SSL termination with HTTP-to-HTTPS redirect, gzip, security headers, and rate limiting. Copy a ready-to-use config that runs entirely in your browser.

Where do I put the generated config?

On most systems, save the server block in /etc/nginx/conf.d/yourdomain.conf or /etc/nginx/sites-available with a symlink into sites-enabled. The limit_req_zone line, when rate limiting is on, must live in the http{} context, not inside a server block.

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_zone directive must sit in the http context (the top of nginx.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 separate location with expires 1y; and Cache-Control: immutable.
  • Always validate before reloading: nginx -t checks syntax, then nginx -s reload applies the change with zero downtime.