Nginx Config Generator

Build a complete nginx server block from simple toggles, live in your browser. Your inputs stay on your device.

Your domain, paths, and certificate locations are used only in your browser to build the config, which is never uploaded. Still, avoid pasting real private-key contents into any tool.

Need file permissions for your web root? Try the Chmod Calculator.

About Nginx Config Generator

This nginx config generator turns a handful of inputs and toggles into a complete, valid nginx server block you can drop into sites-available. Pick a static site (root + index with try_files) or a reverse proxy (proxy_pass with the standard Host, X-Real-IP, X-Forwarded-For, and X-Forwarded-Proto headers, plus optional WebSocket upgrade lines). Flip on SSL to listen on 443, wire up ssl_certificate and ssl_certificate_key, and emit a second server block that 301-redirects HTTP to HTTPS. Add gzip, long-lived static asset caching, a client_max_body_size limit, and a canonical www-to-non-www redirect with one click each. As an nginx config generator it keeps braces balanced and indentation clean, then lets you copy the result or download it as <domain>.conf. Everything runs in your browser, so your domain and paths stay on your device.

Features

How to use the Nginx Config Generator

  1. Enter your domain and listen port, and choose static site or reverse proxy.
  2. Fill in the root and index, or the proxy_pass upstream for your app.
  3. Toggle SSL, gzip, caching, body size, and a www redirect as needed.
  4. Read the live nginx config on the right, then Copy or Download the .conf.

Example

Input

Domain: example.com
Mode: Reverse proxy
Upstream: http://127.0.0.1:3000
SSL: on

Output

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name example.com www.example.com;

    ssl_certificate /etc/ssl/certs/example.com.crt;
    ssl_certificate_key /etc/ssl/private/example.com.key;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;

    return 301 https://$host$request_uri;
}

A reverse proxy on 443 with the matching HTTP→HTTPS redirect block.

Common errors & troubleshooting

Frequently asked questions

How do I set up a reverse proxy in nginx?
Choose Reverse proxy, enter your upstream in proxy_pass (for example http://127.0.0.1:3000), and the generator adds a location / block with the standard Host, X-Real-IP, X-Forwarded-For, and X-Forwarded-Proto headers. Enable WebSocket support if your app uses ws/wss.
Where do nginx server blocks live?
On Debian and Ubuntu, save the generated file as /etc/nginx/sites-available/example.com and symlink it into sites-enabled. On many other distros, drop it in /etc/nginx/conf.d/example.com.conf, then run nginx -t and reload.
How does the SSL toggle change the config?
It switches the main server to listen on 443 ssl, adds ssl_certificate and ssl_certificate_key, and emits a second server block on port 80 that 301-redirects every request to https://, so visitors always land on the secure site.
What is the difference between a static site and a reverse proxy here?
Static mode serves files from a root directory with index and a try_files location, ideal for HTML, SPAs, or built assets. Reverse proxy mode forwards requests to an upstream app server with proxy_pass and proxy headers instead of serving files.
Can I add gzip and static asset caching?
Yes. The gzip toggle adds a tuned gzip block for text, JSON, JavaScript, CSS, XML, and SVG, and the caching toggle adds a location that sets a 30-day expires and an immutable Cache-Control header for common asset extensions.
Is my domain or config sent anywhere?
No. This nginx config generator runs entirely in your browser, so the domain, paths, and certificate locations you type are processed on your device and the generated file is never uploaded.

Related tools

All ArrayKit tools