MagmaNex LogoMagmaNex

Nginx Config Generator

Generate Nginx server blocks

What does this tool do?

The Nginx Config Generator builds a ready-to-use Nginx server block from your domain and chosen mode. It supports reverse proxy, static file serving and SPA (React/Vue) modes, and you can add SSL, Gzip and a www redirect with a single click. It saves time for developers and sysadmins setting up servers.

How to use it

  1. Enter your configuration details.
  2. Review the generated output.
  3. Copy the ready-to-use code or file.

Three deployment scenarios

The mode selector tailors the config to your use case. Proxy mode generates a location block that forwards to an app on the port you specify and handles WebSocket upgrades. Static mode adds a root directory, try_files, and 30-day cache headers for images and assets. SPA mode falls every request back to index.html for client-side routing and caches assets as immutable for a year. Each scenario follows established Nginx best practices so you can paste it straight into your site configuration.

SSL, Gzip and www in one click

Ticking the SSL box adds Let's Encrypt certificate paths, TLS 1.2/1.3 protocols and a secure cipher suite, plus a 301 redirect from port 80 to HTTPS. The Gzip option enables compression for common text types. The www redirect produces a separate server block that points the www subdomain at your bare domain. The entire config is assembled in your browser, so no data is ever sent to a server.

Frequently asked questions

Does proxy mode support WebSockets?

Yes. The proxy block sets the Upgrade and Connection headers and uses proxy_http_version 1.1, so WebSocket connections are upgraded correctly.

What is the difference between static and SPA mode?

Static mode returns a 404 for missing files; SPA mode routes every unmatched request to index.html so that client-side routers work on page refresh.

Does this tool obtain the certificates for me?

No. It only writes the config that points to Let's Encrypt certificates. You still need to obtain them separately on your server with a client like certbot.

Is Nginx Config Generator free?

Yes. Nginx Config Generator and all 300+ tools on MagmaNex are completely free with no signup or account required.

Is my data safe?

Yes. Everything runs locally in your browser. The data you enter is never sent to a server, stored, or shared.

Does it work on mobile?

Yes. Nginx Config Generator works on phones, tablets and desktops — no app download needed.

🔒 Privacy: everything runs in your browser, your data is never sent to a server.

Related Tools

📝 Related Articles

Popular Tools