Advertisement

Nginx Config Maker

Build a ready-to-paste Nginx server block from a few inputs: domain, root path, ports, HTTPS, www redirect, PHP-FPM, gzip and security headers. Copy it straight into sites-available.

Server block options

Fill in the basics, toggle extras.

Extras
# config

Validate with nginx -t before reloading.

Advertisement

What a server block does

An Nginx server block tells Nginx which site a request belongs to (server_name), where its files live (root), and how to handle dynamic content. This builder assembles one from your inputs: listen ports, SSL termination, www redirects, PHP-FPM proxying, gzip compression and security headers, in the canonical order used by production configs.

Using the generated config

The output is a starting point, not a finished production config. After pasting it into sites-available and symlinking to sites-enabled, run nginx -t to validate syntax, point the ssl_certificate paths at your real certbot files, and adjust the PHP-FPM socket to match your version.

Nginx Config Maker FAQs

How do I use the generated config?
Fill in your domain and root path, toggle the options you need, and copy the output into /etc/nginx/sites-available/your-site, then symlink it into sites-enabled and reload Nginx.
Does it support HTTPS?
It emits the standard listen 443 ssl block with ssl_certificate and ssl_certificate_key lines. Replace the placeholder paths with your certbot files, usually under /etc/letsencrypt/live/your-domain/.
Can it configure PHP-FPM?
Yes. The PHP toggle adds a location block that proxies .php files to the PHP-FPM Unix socket, with the standard SCRIPT_FILENAME parameter and a deny rule for hidden files.
How do www redirects work here?
The www toggle adds a separate server block that 301-redirects www to the bare domain (or the reverse, depending on what you type). This avoids duplicate-content SEO issues.
How do I test the config safely?
Run sudo nginx -t before reloading. It checks syntax without touching the running server. If it reports success, run sudo systemctl reload nginx.
Advertisement