🔒 100% private — runs in your browser, nothing is uploaded

Nginx Config Generator

Generate a clean nginx server block — domain, root, port, optional HTTPS, PHP-FPM and gzip — ready to paste and test.

Most nginx mistakes are not exotic: a missing semicolon, a root that points one folder too high, or a PHP location block copied from a tutorial for a different setup. Generating the block from a few explicit choices removes that whole class of typo. Worked example: with domain example.com, root /var/www/example, port 80, HTTPS off, PHP off and gzip on, the output is a single server block containing server_name example.com;, listen 80; and root /var/www/example;, plus a gzip section. Switching HTTPS on replaces the listen line with listen 443 ssl; and adds ssl_certificate lines, and ticking PHP adds a location block with fastcgi_pass to the PHP-FPM socket.

The config is assembled in this browser from the values above. Your domain, paths and settings are never uploaded, stored or put into a link; they stay in this page on your device only. Always test a new config with nginx -t before reloading a live server.

Quick answers

How do I generate an nginx server block?

Enter a domain, a document root and a port, then choose HTTPS, PHP and gzip. For example.com with root /var/www/example on port 80, the block contains server_name example.com;, listen 80; and root /var/www/example;.

HTTPS swaps in listen 443 ssl; with certificate paths, and PHP adds a fastcgi_pass location block. Always validate with nginx -t before reloading.

What does the gzip option add?

A gzip on; block covering the text-based types that actually benefit — CSS, JSON, JavaScript and XML — with a 1024-byte minimum length, so tiny responses are not compressed pointlessly.

Images and already-compressed formats are deliberately excluded: gzipping them wastes CPU for no size saving.

How to use

  1. Enter your domain and document root, and the port for plain HTTP (80 is the standard choice).
  2. Switch HTTPS on if you have a certificate — the block then listens on 443 ssl and points at the usual Let’s Encrypt certificate paths for your domain.
  3. Tick PHP if the site runs through PHP-FPM, gzip if you want text compression, and the www redirect if the apex domain is canonical.
  4. Copy or download the block, place it in sites-available, enable it, and always run nginx -t before you reload — the generator gives you a starting block, not a substitute for testing.

About this tool

What this deliberately leaves out matters as much as what it includes. There are no invented security headers, no fake rate limits and no caching rules with made-up lifetimes — those choices depend on your application, and a generator that guesses them creates a false sense of being configured. Add them deliberately for your site, check the certificate paths match where your certificates actually live (the defaults shown are the standard Let’s Encrypt locations), and remember the golden rule: nginx -t first, reload second, on every change.

Frequently asked questions

Where do I put the generated file?

On Debian and Ubuntu layouts, save it under /etc/nginx/sites-available/, symlink it into sites-enabled, then run nginx -t and reload. On other layouts it belongs wherever your main nginx.conf includes server blocks from — the block itself is the same.

Why does HTTPS mode ignore my port number?

Because HTTPS has a standard port: with HTTPS on, the block listens on 443 ssl and uses your certificate. The port field only applies to the plain-HTTP block. A common production setup runs both — a port-80 block that redirects to the 443 block — which you can add by generating twice and adding a return 301 line to the HTTP copy.

What PHP socket does the PHP option use?

The widely used default unix:/run/php/php-fpm.sock. If your distribution or PHP version names it differently (for example php8.2-fpm.sock), edit that one fastcgi_pass line to match — the rest of the block is unaffected.

Are my domain and paths uploaded anywhere?

No. The config is assembled in this browser from the fields above, and your values are never uploaded, stored or put into a link.

📦 Embed this tool on your site

<iframe src="https://verystep.com/embed/nginx-config-generator/" title="Nginx Config Generator" width="100%" height="520" loading="lazy" style="border:0"></iframe>

Free to use. The embed shows a small "Powered by Verystep" link.

First time embedding? Read the step-by-step guide →

More free tools