NGINX Config Builder
Generate a correct NGINX server block — reverse proxy, static hosting, SSL and redirects — without hand-writing directives.
Examples
Build an HTTP reverse proxy
Server name: api.example.com
Listen port: 8080
SSL: off
Client max body size: 2M
Location: / (reverse proxy)
Upstream: http://127.0.0.1:3000server {
listen 8080;
listen [::]:8080;
server_name api.example.com;
client_max_body_size 2M;
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;
}
}
A proxy location includes the upstream plus Host, client-IP, forwarded-chain, and original-scheme headers.
Serve an HTTPS single-page application
Server name: app.example.com
SSL: on
Redirect HTTP to HTTPS: on
Certificate: /etc/letsencrypt/live/app.example.com/fullchain.pem
Key: /etc/letsencrypt/live/app.example.com/privkey.pem
Location: / (static files)
Root: /srv/app
SPA fallback: onserver {
listen 80;
server_name app.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name app.example.com;
ssl_certificate /etc/letsencrypt/live/app.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/app.example.com/privkey.pem;
location / {
root /srv/app;
try_files $uri $uri/ /index.html;
}
}
Enabling both SSL and HTTP redirect emits two server blocks, while SPA fallback sends unmatched static paths to index.html.
About this tool
NGINX configuration is powerful but unforgiving: directives must sit in the right context, proxy setups need the right forwarded headers to avoid broken client IPs and redirect loops, and a missing try_files line is the classic reason a single-page app 404s on refresh. This builder assembles a correct server block from a form so you get the boilerplate right.
Add location blocks of three kinds — a reverse proxy (with Host and X-Forwarded-* headers pre-filled), static hosting from a document root (with an optional SPA fallback to index.html), or a redirect with your chosen status code. Turn on SSL to emit listen 443 ssl with your certificate paths, and enable HTTP-to-HTTPS to generate a companion port-80 server that permanently redirects. Optional gzip and client_max_body_size round out the common cases. Everything runs in your browser.
How to use
Set the server basics
Enter the server name (domain) and listen port, or enable SSL to switch to 443.
Add location blocks
Choose reverse proxy, static files or redirect for each path and fill in the target.
Enable SSL and redirects
Turn on SSL with your cert/key paths and add an HTTP→HTTPS redirect if needed.
Copy the config
Copy the generated server block into sites-available and reload NGINX.
Use cases
Reverse-proxying an application server
Generate the common proxy_pass and forwarded-header boilerplate for a Node.js, Python, or other local upstream.
Hosting a static SPA
Create a document-root location with index.html fallback so client-side routes survive a browser refresh.
Bootstrapping TLS server blocks
Add certificate paths, IPv4 and IPv6 port 443 listeners, and an optional companion HTTP-to-HTTPS redirect.
Combining path behaviors
Assemble multiple proxy, static, and redirect locations in one generated server block.
Location types
| Type | Generates |
|---|---|
| Reverse proxy | proxy_pass + Host / X-Real-IP / X-Forwarded-For / X-Forwarded-Proto |
| Static files | root + try_files (with optional SPA fallback to index.html) |
| Redirect | return <code> <target>; |
| SSL | listen 443 ssl + ssl_certificate / ssl_certificate_key |
| HTTP→HTTPS | A port-80 server that 301-redirects to HTTPS |
Config is generated client-side — nothing is uploaded.
Common mistakes
Mistake:Deploying the generated text without testing the complete NGINX configuration.
Fix:Place it in the intended context and run nginx -t before reloading. The builder renders form values but does not invoke NGINX or validate the surrounding configuration.
Mistake:Enabling SSL and assuming the named certificate and private-key files already exist and match.
Fix:Provision the certificate separately, verify both paths and permissions on the server, and confirm the certificate covers the configured server name.
Mistake:Pasting untrusted text into directive fields and treating the output as sanitized.
Fix:Review every domain, path, upstream, redirect, size, and status value. The builder trims and interpolates strings; it does not escape arbitrary NGINX syntax.
Mistake:Ignoring URI-joining behavior when changing proxy_pass or location paths.
Fix:Check the upstream URI and trailing slashes against the routing behavior you need, then test representative requests before deployment.
Frequently asked questions
Related guides
References & standards
Related tools
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
Ansible Playbook Generator
Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML
Apache Config Generator
Build an Apache 2.4 VirtualHost — ServerName, DocumentRoot, Directory, aliases, and optional SSL
AWS Architecture Diagram
Drag-and-drop AWS service blocks, connect edges and export architecture diagrams as SVG
AWS Pricing Calculator
Estimate monthly AWS costs from static list prices with a Chart.js breakdown
Azure Architecture Diagram
Compose Azure architecture diagrams with VM, Storage, Functions, AKS blocks and SVG export