nginx Config Generator

Generate common nginx server blocks: static site with caching, reverse proxy to a Node/Python backend, PHP-FPM site, with optional Let's Encrypt SSL config. Output is ready for /etc/nginx/sites-available/.

How to use the nginx Config Generator

Pick the type (static for HTML files, proxy for forwarding to Node/Python on a port, PHP for WordPress / Laravel / similar). Set the server name and root or upstream port. Toggle HTTPS — when on, the config redirects HTTP to HTTPS and assumes you'll run certbot for the cert.

Generating an nginx server block

An nginx server block ties together the pieces a site needs — the domain it answers for, where files live or which backend to proxy to, TLS, compression, and headers — and small mistakes like a missing try_files or the wrong proxy headers produce 404s or broken apps that are tedious to debug. Starting from a known-good block for your site type avoids the most common of them.

This generates a block for the three common shapes — a static site, a reverse proxy to a Node or Python backend, and a PHP-FPM site — with optional Let’s Encrypt HTTPS, gzip, and security headers, ready for sites-available. It is the quick preset-driven path; for finer control over the listen port and protocol toggles like HTTP/2 and HSTS, the nginx server block builder exposes them individually, and to check location matching before deploying, use the nginx rewrite tester.

Common use cases

  • New site — drop in a working block for a static, proxied, or PHP site.
  • Reverse proxy — forward a domain to a Node or Python app on a local port.
  • HTTPS setup — get the HTTP-to-HTTPS redirect and TLS scaffolding for certbot.
  • PHP-FPM — wire up the fastcgi_pass block for WordPress, Laravel, and similar.
  • Learning nginx — read a correct block to understand how the directives fit together.

Frequently asked questions

Where does the config go?

In /etc/nginx/sites-available/, symlinked into sites-enabled, then nginx -t and reload.

Does it get the TLS certificate?

No — it writes the config assuming you run certbot (Let’s Encrypt) for the actual certificate.

How is this different from the server block builder?

Same job; this is preset-first, while the nginx server block builder exposes the listen port, HTTP/2, and HSTS as separate toggles.

Can I test my rewrite rules?

Yes — the nginx rewrite tester shows which location a given request path matches.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: