NGINX server block Generator
Build an NGINX server block: server_name, listen, root, index, location / try_files, gzip and logs. Starter config ready.
—
An nginx server block for static sites
Fresh server, files already in /var/www, and the only thing missing is the block nginx will read. It is always the same shape, yet a semicolon goes missing or try_files comes out wrong. Fill in server_name, port, root and index, decide whether you want gzip, and the block appears complete with access_log, error_log and a root location. The Copy button drops it on your clipboard.
One thing about the gzip directive: nginx always compresses text/html, which is why that type never appears in gzip_types and adding it changes nothing. The list covers everything else. Watch JavaScript in particular: the output lists application/javascript, but depending on the version nginx serves .js as text/javascript, which then falls outside the list. Check with curl -H "Accept-Encoding: gzip" -I and adjust.
Save it in /etc/nginx/sites-available with a symlink in sites-enabled (Debian and Ubuntu) or straight into /etc/nginx/conf.d/your-site.conf, then run nginx -t before reloading. The generated try_files ends in =404, which is right for a static site; for an SPA with client-side routing, replace =404 with /index.html. No TLS comes out of this: typing 443 ssl in the listen field produces a block with no ssl_certificate and nginx -t will reject it.
Frequently asked questions
Does it work for a React or Vue site?
How do I add HTTPS to this config?
Can I keep www and non-www in the same server_name?
Related Tools
Rollup Config Generator
Generates a rollup.config.js to bundle libraries as ESM and CommonJS, with the node-resolve, commonjs and terser plugins already wired. A fixed block, ready to tweak.
Prisma Init Generator
Generate an initial schema.prisma.
.env Formatter
Formats .env files: sort variables, group by prefix, quote values and remove duplicates.
Prettier Config Generator
Generates a ready .prettierrc with the most common choices: single quotes, no semicolons, trailing commas and a 100-column line.
Tailwind Config CLI Generator
Generate a ready-to-use tailwind.config.js for the Tailwind CLI, with content paths and theme set up. Copy it and start styling in seconds.
railway.toml Generator
Generate a railway.toml with build, start and healthcheck settings ready for your Railway deploy. Configure it in the browser and drop it in your repo.