← back to flaviocopes.com

Nginx config generator

← All tools

Pick what you're serving — a static site, an SPA, or a Node.js app behind a reverse proxy — set your domain and options, and get a complete nginx config with an explanation of every directive.

~~~

What are you serving?

~~~

Options

~~~

Generated config

Save it as /etc/nginx/sites-available/yourdomain, symlink it into sites-enabled, then test and reload with:. The -t flag validates the config before the reload, so a typo never takes the server down.

~~~

What each directive does

~~~

About this tool

nginx is the web server you'll most often meet on a Linux VPS: it serves static files fast, terminates TLS, and works as a reverse proxy in front of Node.js apps. Most real-world configs are variations of a handful of patterns — this tool generates the four most common ones.

The HTTPS blocks assume you use certbot with Let's Encrypt: the certificate paths in the generated config (/etc/letsencrypt/live/...) are exactly where certbot puts them. Run certbot first, then drop this config in.

Everything runs in your browser — the config is generated locally and nothing you type leaves the page.

~~~

Read more