Nginx Config Generator

Generate an Nginx configuration for your site. Enter the domain, choose whether Nginx proxies to an app, serves static files, hosts a single-page app or runs PHP, and switch on HTTPS with an automatic redirect, Let's Encrypt certificate paths, HTTP/2, gzip, static caching, security headers and WebSocket support. Download the server block and drop it into sites-available. It's free, runs in your browser, and nothing is sent anywhere.

Modes

ModeKey directive
Reverse proxyproxy_pass http://127.0.0.1:3000;
Static sitetry_files $uri $uri/ =404;
Single-page apptry_files $uri $uri/ /index.html;
PHPfastcgi_pass unix:/run/php/php8.3-fpm.sock;

When to use it

  1. Put Nginx in front of a Node, Python or Go app.
  2. Host a React or Vue single-page app with client-side routing.
  3. Redirect HTTP to HTTPS and www to the bare domain.
  4. Set up a Laravel or WordPress site with PHP-FPM.

How to Use

  1. Enter your domain and choose what Nginx serves.
  2. Set the app address, document root or PHP-FPM socket.
  3. Toggle HTTPS, HTTP/2, gzip, caching and headers.
  4. Download the file, test with nginx -t and reload.

Features

  1. Reverse proxy, static, SPA and PHP modes
  2. HTTP to HTTPS and www redirects
  3. Let's Encrypt paths and challenge location
  4. HTTP/2 and modern TLS
  5. gzip, caching and security headers
  6. WebSocket support
  7. 100% client-side

FAQs

How do I redirect HTTP to HTTPS in Nginx?

Add a server on port 80 that returns 301 https://yourdomain$request_uri. The generated config includes it, plus the path certbot needs.

Why do SPAs need try_files … /index.html?

Routes like /dashboard don't exist as files; falling back to index.html lets the JavaScript router handle them instead of returning 404.

What headers should a reverse proxy pass?

Host, X-Real-IP, X-Forwarded-For and X-Forwarded-Proto, so the app knows the original host, client IP and whether the request was HTTPS.

Should I turn on HSTS?

Once HTTPS works everywhere, yes — but browsers will refuse HTTP for a year, so make sure every subdomain has a certificate first.

How do I apply the config?

Save it in /etc/nginx/sites-available/, link it into sites-enabled, run nginx -t, then reload Nginx.

Is anything uploaded?

No. The config is generated in your browser.

Technical Details

The generator writes complete server blocks rather than fragments. With HTTPS on, a port-80 server answers Let's Encrypt HTTP-01 challenges from a webroot and redirects everything else with a 301 to the canonical HTTPS host, preserving the path and query; the main server listens on 443 for IPv4 and IPv6 with the certificate paths certbot creates, TLS 1.2 and 1.3 only, and a session cache, with HTTP/2 enabled through the current http2 directive. The www choice adds a separate server that redirects the non-canonical hostname. As a reverse proxy it forwards Host, X-Real-IP, X-Forwarded-For and X-Forwarded-Proto so the application sees the real client and scheme, and can add the Upgrade and Connection headers WebSockets need. Static sites use try_files with a 404, single-page apps fall back to index.html, and PHP passes scripts to PHP-FPM with SCRIPT_FILENAME set from $realpath_root and denies dotfiles. Optional blocks add gzip for text types, long-lived immutable caching for static assets, an upload size limit and security headers, with HSTS only offered once HTTPS is on. Every combination is tested to produce balanced braces.

Developer Tools

Developer Tools

  • README Generator
  • Dockerfile Linter
  • SSH Config Generator
  • .dockerignore Generator
  • README Badge Generator
  • JSON to Zod
  • HTML Table Generator
  • Regex Cheatsheet