This free tool builds a complete, commented nginx.conf and the matching site files for you. Choose your domain, PHP or Python backend, HTTPS and HTTP/2, caching, compression, security headers and logging, then download the files or copy them. You start from a safe, fast baseline instead of a blank file. It is based on the open-source nginxconfig.io project.
| System | Main file | Site configs |
|---|---|---|
| Debian / Ubuntu | /etc/nginx/nginx.conf | /etc/nginx/sites-available/ (symlinked into sites-enabled/) |
| RHEL / Rocky / AlmaLinux | /etc/nginx/nginx.conf | /etc/nginx/conf.d/*.conf |
| Docker (official image) | /etc/nginx/nginx.conf | /etc/nginx/conf.d/ |
| macOS (Homebrew, Apple silicon) | /opt/homebrew/etc/nginx/nginx.conf | /opt/homebrew/etc/nginx/servers/ |
Not sure which file your server uses? Ask Nginx itself:
nginx -T 2>/dev/null | head -5
nginx -V 2>&1 | tr ' ' '\n' | grep conf-path
sudo nginx -t # syntax check; prints the file and line of any error
sudo systemctl reload nginx # apply without dropping connections
sudo tail -f /var/log/nginx/error.lognginx -t doubles as a config checker: run it after every change and before every reload.
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
http2 on;
server_name www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
return 301 https://example.com$request_uri;
}http2 on; needs Nginx 1.25.1 or newer. On older versions write listen 443 ssl http2; instead.
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.(?!well-known) { deny all; }location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}Step by step with TLS and firewall: complete guide to building a secure Nginx reverse proxy. Performance settings: mastering Nginx configurations for optimal web server performance.
Nginx runs well on a small VPS. Try it on a Serverion VPS from €5 per month, or take a dedicated server from €40 per month for busy sites.
A tool that builds the nginx.conf and site files from your choices (domain, PHP or Python backend, HTTPS, caching, security headers) so you do not write them by hand.
Yes. It is free to use and needs no sign-up. It is based on the open-source nginxconfig.io project; the credits are in the footer of the tool.
Copy the files into /etc/nginx/ as shown by the tool (see the table above for other systems), then run nginx -t and reload Nginx.
Run sudo nginx -t. It reports the file and line number of any syntax problem and does not touch the running server.
It has presets for WordPress, Drupal and Magento, PHP-FPM and Python (uWSGI) backends, and a reverse proxy option for Node.js or any other backend.
The PHP socket presets in the tool stop at PHP 7.3. For PHP 8, change the fastcgi_pass line in the generated php_fastcgi.conf to your PHP 8 socket, for example /run/php/php8.3-fpm.sock.
Yes. The site options include HTTPS with Let's Encrypt or your own certificate, HTTP/2 and HSTS.
It includes security headers and sensible defaults, but always review it and test on a staging server before production.