← All Tools
Nginx Config Generator🔒 100% local
Generate server blocks. Privacy-first, no server uploads, no tracking.
Related Tools
Writes an nginx server block from three comma-separated values - domain, port and document root - plus an optional fourth value for the mode: "spa" for client-side routing, or "proxy" and "proxy:3000" for a reverse proxy. The block carries listen lines for IPv4 and IPv6, security headers, gzip settings, a one-year cache rule for fingerprinted assets and a try_files location.
How to use it
- Enter "domain, port, root", for example "example.com, 80, /var/www".
- Add a fourth value when you need one: "spa" or "proxy:3000".
- Press Process, then copy the block into /etc/nginx/sites-available/ - the output also prints the symlink, the nginx -t check and the reload command.
Worked example
example.com, 80, /var/wwwbecomesGenerated nginx server block — example.com on port 80, static files
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www;
index index.html index.htm;The first six lines only. What follows adds the security headers, gzip block, immutable-cache location, try_files location, deploy commands and the gotchas list.
app.example.com, 443, /var/www/app, spabecomes# SPA: send unknown paths to index.html so client routing works
location / {
try_files $uri $uri/ /index.html;
}The spa mode replaces the default "=404" fallback, and the server_name line becomes "app.example.com www.app.example.com".
When to use it
- Standing up a static site or a single-page app behind nginx for the first time.
- Adding a reverse-proxy block for a local Node or Python service on port 3000.
- Getting a starting point that already has the common security headers and a cache rule in place.
What it does not do
- Every domain gets " www." prepended to itself in server_name, and only the literal "*.example.com" is special-cased. Enter "*.foo.com" and you get "server_name *.foo.com www.*.foo.com;", which nginx will reject at config-test time.
- The fourth value "proxy" without a colon silently proxies to port 3000, not to your app's port, and the block is generated for plain HTTP - no TLS directives, no certificate paths and no HTTP-to-HTTPS redirect.
- The closing note always reads "Port 80 here" whatever port you asked for, so a block generated for 443 still tells you to run certbot for port 80.
- The domain check only requires letters, digits, dots and hyphens with at least one dot, so "foo.bar" passes. Whether it is a domain you control, and whether the root exists on the server, is not something this tool can know.