Nginx Config Generator

Generate an nginx server block for PHP, static sites, SPAs or reverse proxies — HTTPS, redirects, gzip and caching.

Runs instantly in your browser — results update as you type.

How do I write an nginx config for my site?

Enter your domain and site type and tick the features you need. The generator writes complete server blocks: HTTP-to-HTTPS and www redirects, Let’s Encrypt certificate paths, security headers, gzip, static file caching and the right location rules for PHP-FPM, SPAs or proxying to a Node/Python app.

Install it

  1. Save it as /etc/nginx/sites-available/example.com and link it into sites-enabled.
  2. Get a certificate: sudo certbot certonly --nginx -d example.com -d www.example.com.
  3. Test and reload: sudo nginx -t && sudo systemctl reload nginx.

Frequently asked questions

Which PHP socket path should I use?

Check /run/php/ — it is usually php8.x-fpm.sock matching your PHP version.

Does it support WebSockets in proxy mode?

Yes, Upgrade and Connection headers are included.

Is it safe to use as-is?

It follows common best practice, but always run nginx -t before reloading.