Dev
Dummy Nginx Config Generator
Writing an Nginx server block from memory is error-prone — one misplaced semicolon or wrong SSL certificate path breaks the whole site. This dummy Nginx config generator produces syntactically correct server block configurations for static sites, reverse proxies, Node.js apps, and PHP applications in seconds. Enter your domain name, choose whether to include SSL, and select your server type to get a complete, copy-paste-ready config. The generated configs follow real-world conventions: SSL paths match default certbot output, proxy headers include X-Real-IP and X-Forwarded-For, and PHP configs wire up to the standard php-fpm socket. That means less time hunting through documentation and more time actually deploying. This tool is useful whether you're spinning up a new VPS, onboarding a new developer who needs a reference config, or creating test fixtures for Ansible playbooks and Docker setups. The output drops directly into /etc/nginx/sites-available without manual reformatting. For teams, generated configs also serve as a baseline for code review — reviewers can spot deviations from a known-good structure rather than reviewing raw config from scratch. Combine the output with certbot, ufw, and systemd service files to build a repeatable deployment checklist.
How to Use
- 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
- •Bootstrapping a new VPS with a working Nginx server block in under a minute
- •Generating a reverse proxy config for a Node.js app running on port 3000
- •Creating a PHP-FPM config template for WordPress or Laravel deployments
- •Building test fixtures for Ansible roles that manage Nginx site configs
- •Onboarding junior developers who need a correctly-structured config to study
- •Scaffolding a static site config with forced HTTPS redirect for a marketing page
- •Creating reference configs to diff against production to spot drift or misconfigurations
- •Generating a base config for Docker-based Nginx containers during local development
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?
Save the file to /etc/nginx/sites-available/yourdomain.conf, then run: sudo ln -s /etc/nginx/sites-available/yourdomain.conf /etc/nginx/sites-enabled/. After symlinking, test the syntax with nginx -t and reload with sudo systemctl reload nginx. Do not skip the -t check — it catches errors before they take the server down.
Does the SSL config work with Let's Encrypt certbot?
Yes. The SSL certificate and key paths in the generated config match certbot's default output at /etc/letsencrypt/live/yourdomain/. Run certbot first to generate the actual certificate files, then drop in the generated config. If you changed certbot's output directory, update the ssl_certificate paths accordingly.
What is a reverse proxy Nginx config and when do I use one?
A reverse proxy config passes incoming HTTP requests from Nginx to a backend process — like a Node.js, Python, or Ruby app — listening on a local port. Nginx handles SSL termination and static file serving while the app handles application logic. Use this setup whenever your backend app can't or shouldn't be exposed directly to the internet.
What backend port does the reverse proxy config use?
The generated reverse proxy config forwards to localhost:3000 by default, which is the standard port for Node.js and many other frameworks. Change the proxy_pass URL to match your actual backend port — for example, proxy_pass http://127.0.0.1:8080; for a Gunicorn or Uvicorn server.
How do I use the generated config with Docker or docker-compose?
Copy the generated config into your Nginx container's /etc/nginx/conf.d/ directory via a volume mount or Dockerfile COPY instruction. For reverse proxy setups, change the proxy_pass host from 127.0.0.1 to your backend service name as defined in docker-compose.yml, since containers communicate by service name, not localhost.
Does the PHP config work with WordPress?
Yes, with minor additions. The generated PHP config routes .php requests to php-fpm via the standard Unix socket. For WordPress, also add a try_files $uri $uri/ /index.php?$args; rule inside the root location block to enable permalink routing. The generated config gives you the correct php-fpm fastcgi_pass line and fastcgi_params include.
How do I test an Nginx config without a real domain?
Add a fake domain entry to your local /etc/hosts file pointing to 127.0.0.1 (e.g., 127.0.0.1 example.com), then run Nginx locally. This lets you test the server block routing without DNS or a live server. Skip the SSL section or use a self-signed certificate when testing locally.
What does the X-Forwarded-For header do in the reverse proxy config?
It passes the original client IP address to the backend application. Without it, your app only sees Nginx's local IP and cannot log real visitor IPs or apply IP-based rate limiting. The generated config includes proxy_set_header X-Real-IP and X-Forwarded-For headers automatically for reverse proxy configs.