Server blocks made easy

Nginx Config Generator

Build a static site, reverse proxy or single-page-app server block, with gzip and HTTPS redirect options, then copy or download.

nginx.conf

        

How it works

1

Pick a mode

Static site, reverse proxy, or single-page-app fallback.

2

Fill in the details

Server name, port, root path or proxy target, gzip and HTTPS options.

3

Copy or download

Get a correct server block, ready to drop into your nginx config.

FAQ

What does SPA fallback mode do?

It adds try_files $uri $uri/ /index.html; to the location block, so client-side routes (like /about in a React or Vue app) still load index.html instead of returning a 404.

Do I need to fill in SSL certificate paths myself?

Yes. Enabling the HTTPS redirect option adds a listen 443 ssl; block with placeholder ssl_certificate and ssl_certificate_key paths that you should replace with your real certificate files.

What does the reverse proxy mode generate?

It generates a location block with proxy_pass pointing at your target, plus the standard proxy_set_header lines needed to forward the original host, client IP and protocol, and to support WebSocket upgrades.

Try other tools