Nginx Config Generator

Generate a ready-to-use Nginx server block. Enter your domain and document root, toggle the options you need, and copy the config.

Test the config with nginx -t before reloading. SSL paths assume certificates from Certbot.

How to Use

  1. Enter your domain name and document root path.
  2. Tick PHP-FPM if the site runs PHP, SSL if you have a certificate, and any other options.
  3. Press Generate config.
  4. Press Copy and save the block as a site file, e.g. /etc/nginx/sites-available/example.com.
  5. Run nginx -t to test, then reload Nginx.

Key Features

  • PHP-FPM support — adds the standard PHP location block.
  • SSL ready — includes Certbot certificate paths and a 443 listener.
  • www redirect — optional separate server block redirecting www to the bare domain.
  • Gzip included — compresses CSS, JS and JSON responses.
  • 100% private — runs entirely in your browser; nothing is sent or stored.

FAQs

Where do I put the generated file?

Save it under /etc/nginx/sites-available/, then symlink it into /etc/nginx/sites-enabled/ and reload Nginx.

How do I get an SSL certificate?

Certbot from Let’s Encrypt is the usual free route. The generated paths match Certbot’s default layout.

Does this handle HTTP to HTTPS redirects?

The www-redirect block preserves the scheme. For a full HTTP-to-HTTPS redirect, add a port 80 block returning 301 to https:// — or let Certbot add it.

Which PHP version does it target?

The socket path uses the generic php-fpm.sock. Adjust it to your installed version, e.g. /run/php/php8.3-fpm.sock.

Is my data sent anywhere?

No. Everything runs entirely in your browser and never transmits or saves your entries.

Related Tools

Try these related tools: Port Lookup, Dockerfile Generator and Gitignore Generator.

Scroll to Top