Build a complete nginx server block from simple toggles, live in your browser. Your inputs stay on your device.
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.
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
Static site mode with root, index, and a try_files location block
Reverse proxy mode with proxy_pass and standard proxy_set_header lines
Optional WebSocket support via proxy_http_version, Upgrade, and Connection headers
SSL toggle that adds listen 443 ssl plus an HTTP→HTTPS 301 redirect server
gzip block tuned for text, JSON, JavaScript, CSS, XML, and SVG
Static asset caching location with expires and immutable Cache-Control
client_max_body_size input and www↔non-www canonical redirects
Copy the server block or download it as example.com.conf
How to use the Nginx Config Generator
Enter your domain and listen port, and choose static site or reverse proxy.
Fill in the root and index, or the proxy_pass upstream for your app.
Toggle SSL, gzip, caching, body size, and a www redirect as needed.
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
A reverse proxy on 443 with the matching HTTP→HTTPS redirect block.
Common errors & troubleshooting
nginx -t reports "cannot load certificate" or the SSL block fails to start. — Point ssl_certificate at your fullchain file and ssl_certificate_key at the matching private key, and make sure both paths exist and are readable by nginx.
A reverse-proxied app shows the wrong client IP or breaks behind HTTPS. — Keep the generated proxy_set_header lines so Host, X-Real-IP, X-Forwarded-For, and X-Forwarded-Proto reach your upstream, and read them from the right headers in your app.
WebSocket connections drop with a 400 or fail to upgrade. — Turn on WebSocket support so the location adds proxy_http_version 1.1 with the Upgrade and Connection "upgrade" headers nginx needs to proxy ws/wss.
Large uploads return 413 Request Entity Too Large. — Set client_max_body_size to a value above your largest upload, for example 20M or 100M, and reload nginx.
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
.htaccess Generator — Toggle and configure common Apache .htaccess snippets with live output.
robots.txt Generator — Visually build a robots.txt with user-agent rules, allow/disallow paths, crawl-delay and sitemaps.
Cache-Control Header Builder — Assemble a correct HTTP Cache-Control header from plain toggles and human time units, with copy-ready nginx, Apache, and meta snippets.
Meta Tag Generator — Generate SEO, Open Graph and Twitter Card meta tags for your page from a simple form.
CSP Header Generator — Build a Content-Security-Policy header from directive toggles, with report-only and copy output.
htpasswd Generator — Generate Apache/nginx .htpasswd entries with bcrypt or SHA-1 hashed passwords, in your browser.
Tailwind Color Generator — Generate a full 50-950 Tailwind color scale from one brand color, with config-ready output.
CSS Grid Generator — Build CSS grid layouts visually and copy grid-template-columns, rows and gap.
CSS Clamp Calculator — Calculate a fluid CSS clamp() value from min and max sizes and viewport widths.
Cubic Bezier Generator — Design a cubic-bezier() easing curve with draggable handles and an animated preview.
Redirect Map Generator — Turn an old-to-new URL list into 301 redirect rules for nginx, Apache, Netlify and Vercel.
JSON-LD Generator — Generate schema.org JSON-LD structured data for Article, Product, FAQ and more from a form.
Query String to JSON — Convert a URL query string to JSON and back, handling nested keys and repeated params.