Nginx Config Generator.
Generate an nginx server block for static sites, SPAs, PHP-FPM, Laravel or a reverse proxy, with HTTPS.
Runs in your browserAbout Nginx Config Generator
The Nginx Config Generator writes a complete server block file for the most common setups: a static site, a single-page app, a plain PHP-FPM site, a Laravel application or a reverse proxy in front of Node, Python or Go. Enter a domain such as example.com, pick the site type and decide whether www should redirect to the bare domain or the other way round. With HTTPS switched on you get a port 80 block that answers Let's Encrypt challenges and sends everything else to HTTPS, a block that redirects the alias host, and the main server with certificate paths from /etc/letsencrypt/live, TLS 1.2 and 1.3 only and a shared session cache. The Laravel preset follows the official deployment guide: requests fall through to index.php with the query string, PHP goes to the FPM socket with $realpath_root so symlinked releases work, and dotfiles such as .env are denied while .well-known stays reachable. The SPA preset serves index.html for unknown paths and keeps index.html itself uncached. The reverse proxy preset forwards Host, X-Real-IP, X-Forwarded-For and X-Forwarded-Proto and can add WebSocket upgrades. A classic mistake the generator avoids is losing security headers on static files: nginx drops server-level add_header lines in any location that sets its own, so the headers are repeated there. The notes list the commands to enable the site, issue the first certificate and test the config with nginx -t before reloading. Nothing leaves your browser.
How to Use
- Enter the domain, choose the site type and how www should be handled.
- Adjust the document root, upstream or PHP-FPM socket and switch HTTPS, HSTS, gzip and caching on or off.
- Save the config to /etc/nginx/sites-available, run the commands from the notes and reload nginx.
Frequently Asked Questions
Why does nginx -t fail right after enabling HTTPS?
The 443 server blocks point to certificate files that do not exist yet. Issue the first certificate in standalone mode (or deploy with HTTPS off first), then enable the full config.
Should I turn on HSTS?
Only when every subdomain already serves HTTPS. The generated header includes includeSubDomains and a one-year max-age, and browsers will refuse plain HTTP for that whole time.
Which nginx version does the config need?
The "http2 on;" directive was added in nginx 1.25.1. On older versions delete that line and write "listen 443 ssl http2;" instead. Everything else works on any maintained release.
Is my domain sent to a server?
No. The config is generated in your browser and the page makes no network requests while you use it.
Related Tools
Turn a list of old → new URLs into Apache .htaccess, nginx or Netlify redirect rules.
Trace redirect chains, detect loops, and measure timing.
Reference for all HTTP status codes.
Convert a crontab schedule into a systemd timer and a Kubernetes CronJob, or an OnCalendar back to cron.
Information about your current IP address.
Split AWS ARNs into partition, service, region, account and resource, or build an IAM policy statement.