Nginx Config Generator

Generate production-ready Nginx server configurations for reverse proxies, SPAs, and static sites.

100% Free · No Sign-up · Runs in Your Browser

About the Nginx Config Generator

Nginx is one of the world's most popular web servers and reverse proxies, powering millions of high-traffic websites. However, configuring Nginx directives for reverse proxy header forwarding, Single Page Application (SPA) client-side routing, SSL certificates, and Gzip compression requires precise syntax. This Nginx Config Generator builds production-ready 'nginx.conf' server blocks.

This tool is designed for DevOps engineers configuring web servers, frontend developers deploying React/Vue applications, and backend engineers proxying Node/Python/Go services. It supports Reverse Proxy mode (with WebSocket upgrade and header forwarding), SPA mode (with 'try_files $uri $uri/ /index.html'), and Static HTML hosting, alongside Let's Encrypt SSL and Gzip compression.

To use it, enter your domain name, select your configuration mode, specify upstream backend ports or web root directories, and toggle SSL/HTTPS or Gzip options. The tool generates a complete, annotated Nginx server block ready to deploy.

For instance, in SPA mode, it includes proper caching headers for static assets (images, fonts, css, js) and fallback routing so browser page refreshes don't trigger 404 errors.

A frequent Nginx mistake when proxying Node or Next.js apps is omitting 'proxy_set_header Host $host;' and 'proxy_set_header X-Forwarded-Proto $scheme;', which can cause redirect loops and broken authentication cookies.

Tip: Always test new Nginx configurations on your server with 'nginx -t' before reloading the service with 'systemctl reload nginx'.

Frequently Asked Questions

Q.How does the SPA configuration prevent 404 errors on page refresh?

It uses the directive 'try_files $uri $uri/ /index.html;' to redirect all non-file route requests to index.html for client-side router resolution.

Q.Does the reverse proxy setup support WebSockets?

Yes, it includes 'Upgrade' and 'Connection: upgrade' proxy headers to support real-time WebSocket connections.

Q.Can I download the generated configuration?

Yes, click 'Download' to save the configuration as a .conf file.

Related Tools