All tools

Nginx Config Generator

Code

Generate an nginx config for a reverse proxy, static site, SPA, PHP-FPM or domain redirect, with HTTPS, www redirects, gzip, WebSockets, load balancing and rate limiting

Loading tool…
Was this tool helpful?
nginxconfiggeneratorreverse-proxyserver-blocksslhttpsdevops

About Nginx Config Generator

Pick what the site is (a reverse proxy in front of a Node, Python or Go app, a static site, a React or Vue single-page app, a PHP-FPM app like Laravel or WordPress, or an old domain that should redirect) and get a complete nginx server file you can drop into /etc/nginx/conf.d/. HTTPS comes with the Mozilla intermediate TLS settings, a one-hop HTTP and www redirect, HSTS and security headers, and the certbot command to get the certificate before nginx -t will pass. It handles the details that usually cost an evening: the WebSocket Connection map, keepalive to an upstream pool, a try_files fallback that never caches index.html, PHP's SCRIPT_FILENAME, and asset caching that does not silently drop your add_header lines. Everything is generated in your browser, and the nginx config explainer is there if you want a second opinion on a config you already have.

How to use Nginx Config Generator

  • 1.Choose the site type, enter your domain(s) and the backend address, document root or redirect target.
  • 2.Toggle HTTPS, the www redirect, gzip, WebSockets, rate limiting and the other options; the config updates as you type and the Share button keeps every setting in the link.
  • 3.Copy or download the .conf file, run the certbot command if it shows one, then sudo nginx -t and reload.

Frequently asked questions

Why does nginx -t fail with an unknown directive "http2"?
The http2 on; directive needs nginx 1.25.1 or newer. Ubuntu 22.04 ships 1.18 and Debian 12 ships 1.22, so pick the legacy HTTP/2 option there, which puts http2 on the listen line instead.
nginx -t says the certificate file does not exist. What now?
The default paths are where certbot puts Let's Encrypt certificates, and nginx refuses to load a config whose certificate files are missing. Run the certbot certonly command the tool shows first (a wildcard name needs the DNS challenge), or point the certificate fields at files you already have.
Does it add OCSP stapling or includeSubDomains to HSTS?
No. Let's Encrypt stopped running OCSP in 2025, so ssl_stapling only produces warnings with its certificates, and includeSubDomains on HSTS can lock out subdomains that are not on HTTPS yet. Add either by hand if you know you want it.
Will it check that my backend or PHP-FPM socket actually exists?
No. It validates the syntax of every value so nothing odd lands in the file, but it never connects to anything. Check the PHP-FPM socket with ls /run/php/ (its name includes the PHP version) and always run nginx -t before reloading.

Use via API, SDK, or MCP

cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/nginx-config-generator \
  -H "Authorization: Bearer utx_live_..." \
  -H "Content-Type: application/json" \
  -d '{"serverName":"example.com www.example.com","mode":"reverse-proxy","upstream":"http://127.0.0.1:3000","wwwRedirect":"to-non-www"}'

Get an API key from your dashboard · Full API docs →