Nginx Config Generator

Create an Nginx server block in seconds.

nginx server block
server {
    listen 80;
    server_name example.com www.example.com;

    root /var/www/example.com/public;
    index index.html index.htm;

    location / {
        try_files $uri $uri/ =404;
    }
}

Free online Nginx config generator. Enter your server_name, listen port, document root and index — or a proxy_pass upstream — to produce a clean Nginx server block. Generated in your browser.

How to use the Nginx Config Generator

  1. 01Enter the server_name and listen port.
  2. 02Set a document root and index for static sites, or a proxy_pass URL for a reverse proxy.
  3. 03Copy the generated server block into your Nginx config.

Frequently asked questions

How do I make a reverse proxy?

Fill in the proxy_pass field with your upstream URL (for example http://127.0.0.1:3000). The generator then emits a location block with the standard proxy headers.

Where do I put this server block?

Save it under /etc/nginx/sites-available (or conf.d), enable it, run nginx -t to test, then reload Nginx. This tool generates only the server block itself.