DevTools Logo

Nginx Reverse Proxy Wizard

Nginx Reverse Proxy Wizard

Generate a validated Nginx reverse proxy, TLS and WebSocket configuration, with proxy_pass path rewriting explained.

Runs in your browser
HTTP/2 syntax
Try an example

Configuration

valid

Upstreams

Location rules

Generated nginx.conf

45 lines · 1,218 chars
Location 1: proxy_pass has no URI, so the request path is forwarded unchanged. Add a trailing slash or path (http://app/) to replace the location prefix.
Location 1: WebSocket connections are closed after proxy_read_timeout of silence (60s). Raise it, or send pings from the application.
The map block for $connection_upgrade belongs in the http context. This file works as a conf.d include; remove the map if it is already defined elsewhere.
http2 on; needs nginx 1.25.1 or newer. On older versions pick the legacy listen syntax.
# Generated by Nginx Reverse Proxy Wizard
# Review TLS paths and upstream addresses before deploying.

upstream app {
    server 127.0.0.1:3000 weight=1;
}

map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

server {
    listen 80;
    listen [::]:80;
    server_name example.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name example.com;
    ssl_certificate /etc/nginx/ssl/fullchain.pem;
    ssl_certificate_key /etc/nginx/ssl/privkey.pem;
    gzip on;
    gzip_vary on;
    gzip_types text/plain text/css application/json application/javascript application/xml image/svg+xml;
    client_max_body_size 10m;

    location / {
        proxy_pass http://app;
        proxy_http_version 1.1;
        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;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_connect_timeout 10s;
        proxy_read_timeout 60s;
        proxy_send_timeout 60s;
    }
}

About

Configure domains, weighted upstream servers, exact or prefix locations, WebSocket headers, HTTPS redirects, TLS paths, gzip, body limits, and proxy timeouts entirely in your browser.

    Examples

    Weighted upstream with TLS redirect

    Input
    generateNginxConfig({ domain: "app.example.com", ssl: true, upstreams: [{ name: "api", servers: [{ address: "127.0.0.1:3000", weight: 2 }, { address: "127.0.0.1:3001", weight: 1 }] }], locations: [] })
    Output
    upstream api { server 127.0.0.1:3000 weight=2; server 127.0.0.1:3001 weight=1; } + return 301 https://$host$request_uri;

    Two weighted backends share load 2:1 while port 80 redirects everything to the 443 ssl http2 server.

    Websocket location

    Input
    generateNginxConfig({ domain: "app.example.com", upstreams: [], locations: [{ path: "/socket", match: "prefix", proxyPass: "http://api", websocket: true }] })
    Output
    map $http_upgrade $connection_upgrade { ... } + proxy_set_header Connection $connection_upgrade;

    Enabling websocket adds the connection-upgrade map and the Upgrade/Connection headers to that location block.

    About this tool

    Nginx Reverse Proxy Wizard emits a review-ready nginx config with generateNginxConfig(config): each upstream renders an upstream block with optional weight= suffixes per server, websocket locations add the map $http_upgrade $connection_upgrade block plus Upgrade/Connection proxy headers, and ssl: true adds a port-80 redirect server (return 301 https://$host$request_uri) in front of the 443 ssl http2 server with ssl_certificate paths.

    Inputs sanitize defensively rather than throwing: blank domains fall back to example.com, blank server addresses to 127.0.0.1:3000, non-positive weights are dropped, and unsafe upstream-name characters collapse to underscores. Optional extras — gzip, client_max_body_size, and proxy_connect/read/send timeouts — are emitted only when set, so identical configs always produce byte-identical output.

    Validation is minimal and explicit: validateNginxConfig returns Domain is required. for a blank domain and Add at least one location rule. when no locations exist. Everything runs client-side, so domains, upstream addresses, and certificate paths never leave the browser.

    How to use this tool

    1. Set the domain and TLS

      Enter the server_name domain and toggle ssl, then confirm the certificate and key paths — TLS on adds the HTTP-to-HTTPS redirect server automatically.

    2. Define upstreams with weights

      Add upstream servers as host:port with optional weights (e.g. weight 3 vs 1) to split traffic proportionally across backends.

    3. Add locations and websocket flags

      Map each path to a proxy_pass target with prefix or exact matching, and enable websocket on socket paths to get the upgrade map plus headers.

    4. Copy and review before deploying

      Paste the deterministic output into nginx.conf, verify TLS paths and upstream addresses, and test with nginx -t before reloading.

    Use cases

    Fronting Node APIs with TLS

    Terminate HTTPS in nginx and weighted-proxy to local app servers with a single generated server block.

    Adding websocket endpoints

    Proxy chat or realtime paths with the correct upgrade map instead of hand-writing map and header directives.

    Scaffolding multi-upstream configs

    Draft canary or blue/green weight splits (3 vs 1) and tune the numbers after observing traffic.

    Common mistakes

    Mistake:Expecting an error for a blank domain.

    Fix:The generator falls back to example.com and only validateNginxConfig reports Domain is required. — check the validation messages, not the output, for missing input.

    Mistake:Assuming the websocket map appears for plain locations.

    Fix:The map block is emitted only when at least one location sets websocket: true — enable it on the socket path explicitly.

    Mistake:Copying cert paths without checking them.

    Fix:Blank certificate paths fall back to /etc/nginx/ssl/ placeholders — replace them with the real fullchain/privkey paths before deploying.

    Frequently asked questions

    What does this tool do?

    It generates an nginx reverse-proxy config with generateNginxConfig: weighted upstream blocks, prefix/exact locations with proxy headers, an optional websocket upgrade map, gzip/timeout extras, and an HTTP-to-HTTPS redirect server when ssl is on — plus validateNginxConfig checks for a blank domain and missing locations.

    When does the websocket map appear, and what does TLS add?

    The map $http_upgrade $connection_upgrade block (plus Upgrade/Connection headers) appears only when a location sets websocket: true. Enabling ssl adds a port-80 server with return 301 https://$host$request_uri in front of the 443 ssl http2 server.

    Is my config uploaded or stored?

    No. Generation and validation are pure client-side string building — domains, upstream addresses, and certificate paths never leave your browser.

    Why did a blank domain or zero weight not error?

    Blanks degrade to fallbacks (example.com, 127.0.0.1:3000) and non-positive weights are dropped silently; only validateNginxConfig reports Domain is required. Check its messages before deploying.

    References & standards