Dev
Dummy Nginx Config Generator
Writing an Nginx server block from scratch means juggling SSL certificate paths, proxy headers, and PHP-FPM socket paths — one misplaced semicolon drops your site. A dummy Nginx config generator produces a complete, correct server block from three inputs: domain name, SSL toggle, and server type. Four server types produce different output. Static sites get a root directive with try_files for 404 handling. Reverse proxy and Node.js types produce a proxy_pass block pointing to a randomized upstream port. PHP servers get a root directive and a location ~ .php$ block wired to php8.1-fpm.sock. When SSL is enabled, the output includes an HTTP block that redirects to HTTPS with a 301 and an HTTPS block with certbot paths at /etc/letsencrypt/live/yourdomain/. Always run nginx -t before reloading — it catches syntax errors before they take the server offline.
How to use
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Enter your actual domain name in the Domain Name field, for example app.yourdomain.com.
- Set Include SSL to 'yes' if your server already has a Let's Encrypt certificate, or 'no' to generate a plain HTTP config first.
- Select your Server Type: choose reverse-proxy for Node/Python apps, static for HTML sites, or php for PHP-FPM applications.
- Click Generate and review the output, noting the proxy_pass port or root directory and adjusting them to match your environment.
- Copy the config, save it to /etc/nginx/sites-available/yourdomain.conf, symlink it, run nginx -t, then reload Nginx.
Use Cases
- •Generating a reverse proxy config for a Node.js app on port 3000 before running nginx -t
- •Scaffolding an SSL-enabled static site block for a marketing landing page deploying to a fresh Ubuntu VPS
- •Creating Nginx config fixtures for Ansible roles that manage sites-available in CI pipelines
- •Building a PHP-FPM config baseline for WordPress or Laravel behind Nginx in a docker-compose stack
- •Giving junior engineers a correctly structured reference config to study during onboarding
Tips
- →Generate with SSL disabled first, run certbot --nginx, then regenerate with SSL enabled to compare against what certbot wrote.
- →For Node.js apps using clustering or PM2, change the proxy_pass value to a named upstream block with multiple server lines for load balancing.
- →If you serve multiple subdomains on one VPS, generate a separate config for each — do not stack multiple server_name values in one block until you understand precedence rules.
- →The static site config sets root to /var/www/yourdomain — create that directory and drop an index.html in it to verify the config works before deploying real files.
- →On PHP configs, confirm your installed php-fpm socket path with: ls /run/php/ — it may differ from the generated path if you have multiple PHP versions installed.
- →After editing the config, always run nginx -t before reloading — a syntax error on a reload will leave the old config running, masking your changes silently.
FAQ
how do I activate a generated nginx config on Ubuntu without breaking the site
Save the file to /etc/nginx/sites-available/yourdomain.conf, then symlink it with: sudo ln -s /etc/nginx/sites-available/yourdomain.conf /etc/nginx/sites-enabled/. Always run nginx -t before reloading — it validates syntax and catches errors before taking the server offline. If the test passes, apply with: sudo systemctl reload nginx.
does the ssl config match what certbot actually generates
Yes. The certificate paths use certbot's default output at /etc/letsencrypt/live/yourdomain/, so the config works without edits if you ran certbot with default flags. Run certbot first to create the actual certificate files, then drop in the generated config. If you used a custom output directory, update ssl_certificate and ssl_certificate_key to match.
can I use the reverse proxy config with docker-compose instead of localhost
Yes, but change the proxy_pass host from 127.0.0.1 to your backend's service name as defined in docker-compose.yml — containers resolve each other by service name, not localhost. Mount the generated config into /etc/nginx/conf.d/ via a volume, then restart the Nginx container to pick it up.
what proxy headers does the reverse proxy config include
The reverse proxy and Node.js types include: proxy_http_version 1.1, proxy_set_header Upgrade $http_upgrade, proxy_set_header Connection 'upgrade', proxy_set_header Host $host, and proxy_cache_bypass $http_upgrade. These support WebSocket upgrades and correct host forwarding. X-Real-IP and X-Forwarded-For are not included — add them manually if your application reads those headers.
You might also like
Popular tools from other categories that share themes with this one.
Try these next
More free tools from other corners of the catalog, picked by shared themes.