QiLing Tools

🟢Nginx Config Generator - Reverse Proxy, HTTPS & SPA Configs

Stop piecing together Nginx snippets from blog posts every time you launch a site. Pick a use case, fill in a few fields and get a commented nginx.conf you can drop into conf.d. Use cases include static sites, single-page apps (history-mode routes fall back to index.html, which is never cached), reverse proxies (an upstream block for several backends with round robin, least_conn, ip_hash or random balancing and keepalive), WebSocket proxies (Upgrade headers and long timeouts), PHP-FPM (front controller and fastcgi parameters) and whole-site 301 redirects. Turning on HTTPS adds certificate paths, Mozilla-recommended TLS protocols and ciphers, session caching and HSTS, redirects HTTP to HTTPS while keeping the Let’s Encrypt challenge path, and offers HTTP/2 with either the http2 on; syntax of nginx 1.25.1+ or the older listen flag; you can also force www or the bare domain. Performance and security options cover gzip, 30-day asset caching, security headers, hiding the version, upload size limits, per-IP rate limiting, CORS and basic-auth password protection. A second tab formats minified or messy nginx configs with consistent indentation, keeps comments and checks that braces match.

Free · No sign-up · Runs in your browserLast updated:

Loading tool...

How to use Nginx Config Generator

  1. 1Choose a use case: static site, SPA, reverse proxy, WebSocket, PHP or redirect
  2. 2Enter the domain, document root or backends and toggle HTTPS, gzip, caching, headers and more
  3. 3Copy or download the config, run nginx -t on the server and reload

FAQ

Where do I put the generated config and how do I apply it?
On Debian and Ubuntu, save it in /etc/nginx/sites-available/ and symlink it into sites-enabled/, or put it straight into /etc/nginx/conf.d/ with a .conf extension (conf.d is included inside the http block, which is why upstream, map and limit_req_zone can sit at the top of the file). Then run nginx -t to check the syntax and nginx -s reload or systemctl reload nginx.
Where do I get an HTTPS certificate?
Let’s Encrypt is the usual choice. With the challenge path option enabled, start with the HTTP-only config, run certbot certonly --webroot -w /var/www/certbot -d your-domain, and the certificate lands in /etc/letsencrypt/live/your-domain/. Then enable HTTPS and reload; certbot renews it automatically.
Why does refreshing my single-page app return 404?
History-mode routers such as Vue Router and React Router need every unknown path to be served by index.html, which the SPA preset does with try_files $uri $uri/ /index.html;. The generated config also stops index.html from being cached while hashed assets are cached for a long time, so users get new releases immediately.
Why did some headers disappear after I added add_header?
Nginx only inherits add_header directives from the server block when a location defines none of its own. That is why the generator keeps security headers, HSTS and CORS at the server level and implements asset caching with expires, which does not break inheritance. If you add add_header inside a location, repeat the headers you need there.