Skip to main content
Back to Dev generators

Dev

Nginx Config Generator

Nginx configuration syntax trips up developers who do not work with it daily: the directive names, block nesting, and subtle differences between a static site, a reverse proxy, and a redirect are easy to misremember. This generator produces example Nginx server blocks for all three configuration types so you have a correct, working template to adapt rather than a blank file. The config type dropdown selects what to generate, or random picks from all three. Static site produces a server block that listens on port 80, sets the document root, and uses try_files to serve files or return a 404. Reverse proxy produces a block with proxy_pass pointing at 127.0.0.1 on a randomly chosen port (3000, 4000, 5000, or 8080) and includes proxy_set_header directives for Host and X-Real-IP. Redirect produces a block matching the www subdomain and issuing a 301 to the bare domain with $request_uri preserved. Treat the output as a learning scaffold and a starting point: adapt the domain name, document root path, and proxy port to your actual setup, add a TLS server block for HTTPS, and run nginx -t to validate the config before reloading. The generated block is a correct minimum for each type but is not a finished production configuration.

Read the complete guide — 4 min read

How to use

  1. Choose your options above
  2. Click Generate
  3. Copy your result

Detailed instructions

  1. Choose a config type — static site, reverse proxy, or redirect.
  2. Click Generate to produce an example server block.
  3. Adapt the domain, paths, and ports to your setup.
  4. Add TLS and test the config before deploying it.

Use Cases

  • Learning Nginx server block syntax
  • Starting a static-site, proxy, or redirect config
  • Documentation and tutorial examples
  • Reminding yourself of directive structure
  • Prototyping a configuration before refining it

Tips

  • Run nginx -t to test a config before reloading the server.
  • Add HTTPS with a TLS certificate before going to production.
  • For a reverse proxy, match the proxy_pass port to your app.
  • Treat generated configs as scaffolding, not a finished setup.

FAQ

what is an nginx server block

A server block is the section of an Nginx configuration that defines how to handle requests for a particular domain or port — what to listen on, which server name to match, where files live, and how to route requests. It is the core unit you assemble an Nginx setup from.

is this config production-ready

It is a correct, realistic starting point rather than a finished production config. You should adapt the domain, paths, and ports, add TLS and security headers, and test it before deploying. Treat it as a learning aid and a scaffold to build on.

what is a reverse proxy config for

A reverse proxy server block forwards incoming requests to an application running on another port or host — for example a Node app on port 3000 — while Nginx handles the public-facing connection. It is a very common pattern for serving web apps behind Nginx.

what ports does the reverse proxy config use

The reverse proxy block randomly selects one of four upstream ports: 3000, 4000, 5000, or 8080. These are common default ports for Node.js, Python, and other application servers. Change the proxy_pass port in the output to match the port your actual application binds to.

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.