Nginx Config Generator

Generate production-ready Nginx configs with SSL, reverse proxy, PHP-FPM, gzip, caching, security headers, rate limiting, and redirects. 7 presets included.

Updated

Share:
Home/Website Tools/Nginx Config Generator

Nginx Config Generator

Generate production-ready Nginx configuration files with SSL, reverse proxy, PHP-FPM, caching, security headers, and more.

Preset Templates

Server Block

HTTPS / SSL

Proxy Pass

PHP-FPM

Static Files

GZIP

Security

Redirects

Logging

Generated Config

36 lines

Active Features

Gzip

Frequently Asked Questions

What is the Nginx Config Generator?

The Nginx Config Generator is a free online tool that generate production-ready nginx configs with ssl, reverse proxy, php-fpm, gzip, caching, security headers, rate limiting, and redirects. 7 presets included.. It runs entirely in your browser with no installation or sign-up needed.

What presets?

Seven: Static Site, WordPress, Node.js, Laravel, Next.js, Django, SPA (React/Vue). Each pre-fills appropriate settings.

Complete working config?

Generates a server block for nginx.conf or sites-available. Rate-limiting zone directives shown as comments for the http block.

Is config sent to a server?

No. Everything runs client-side in your browser.

Is the Nginx Config Generator free to use?

Yes, the Nginx Config Generator is 100% free with no registration, no hidden fees, and no usage limits. All processing happens locally in your browser, ensuring complete privacy.

Is my data safe with this tool?

Absolutely. The Nginx Config Generator processes everything client-side in your browser. No data is uploaded to or stored on any server. Your content remains private on your device at all times.

Does the Nginx Config Generator work on mobile devices?

Yes, the Nginx Config Generator is fully responsive and works on smartphones and tablets. You can use it on any device with a modern web browser -- no app download required.

Do I need to create an account to use this tool?

No account or registration is needed. Simply open the Nginx Config Generator in your browser and start using it immediately. There are no sign-up walls or usage restrictions.

How do I use the Nginx Config Generator?

Simply enter your input in the provided field, adjust any settings to your preference, and the tool will process it instantly. You can then copy the result to your clipboard or download it.

Which browsers are supported?

The Nginx Config Generator works in all modern browsers including Chrome, Firefox, Safari, Edge, and Opera. For the best experience, use the latest version of your preferred browser.

Why does the limit_req_zone directive have to go in the http block instead of the server block?

In Nginx, rate limiting needs two pieces that live in different contexts. The limit_req_zone directive defines a shared memory zone (for example, zone=ratelimit:10m rate=...) and is only valid in the top-level http block, because the zone is shared across all server blocks. The matching limit_req directive, which actually enforces the limit with a burst value, belongs inside the server or location block. If you paste limit_req_zone into a server block, Nginx fails to start with a "directive is not allowed here" error. That is why this generator places the limit_req line directly in your server block but emits the limit_req_zone line as a labeled comment, reminding you to move it up into the http context. Enable rate limiting in the tool and copy both pieces into the right place.

What is the difference between a reverse proxy config and a PHP-FPM config in Nginx?

A reverse proxy config uses proxy_pass to forward requests to a separate application server running on its own port, such as a Node.js, Next.js, or Django/Gunicorn process on 127.0.0.1:3000 or :8000. Nginx adds headers like X-Real-IP, X-Forwarded-For, X-Forwarded-Proto, and Host, plus Upgrade and Connection headers when WebSockets are enabled. A PHP-FPM config instead uses a location ~ \.php$ block with fastcgi_pass pointing at a Unix socket and includes fastcgi_params, so Nginx hands PHP files to the FPM process directly rather than proxying HTTP. WordPress and Laravel use the FastCGI path; Node, Next.js, and Django use the reverse proxy path. Pick the matching preset in the generator and it wires up the correct directives for your stack.

How do I redirect HTTP to HTTPS and force www or non-www in one Nginx config?

Both redirects are handled cleanly in a single server block setup. For HTTP-to-HTTPS, a separate server listening on port 80 catches plain requests and issues a 301 to the https:// version, while your main server listens on 443 with SSL. For www versus non-www canonicalization, you redirect one host to the other, again with a 301, so search engines and browsers settle on a single canonical domain instead of treating www and root as duplicate sites. Doing this by hand risks redirect loops if the rules overlap or a directive lands in the wrong server. Toggle HTTP-to-HTTPS and your preferred www or non-www option in the generator, and it writes the correctly ordered redirect blocks for you to copy.

Why should I use listen 443 ssl http2 and TLS 1.2/1.3 instead of older settings?

Adding http2 to the listen 443 ssl line enables HTTP/2, which multiplexes many requests over one connection and noticeably speeds up pages with lots of assets, with no application changes needed. Restricting ssl_protocols to TLSv1.2 and TLSv1.3 drops the older SSLv3, TLS 1.0, and TLS 1.1 protocols that are deprecated and vulnerable to attacks like POODLE and BEAST, so modern clients negotiate only secure ciphers. The generator also adds a hardened cipher suite, a session cache, optional HSTS with preload, and OCSP stapling so certificate revocation checks do not slow the handshake. These are defaults people often forget when hand-writing configs. Enable the SSL section in the tool and these settings are filled in for you to review before deploying.

How do I make client-side routing work in Nginx for a React or Vue single-page app?

Single-page apps handle routing in JavaScript, so when a user refreshes a deep link like /dashboard, the browser asks Nginx for a real file at that path. Without special handling, Nginx returns 404 because no such file exists on disk. The fix is a try_files directive that falls back to your index.html: try_files $uri $uri/ /index.html;. This serves real static assets when they exist but routes every unknown path back to the app shell, letting the client router take over. Forgetting this line is the single most common reason SPA refreshes break in production. The SPA (React/Vue) preset in this generator sets up that history fallback automatically, along with gzip and asset caching, so copy the output and your routes survive a hard refresh.

About the Nginx Config Generator

The Nginx Config Generator builds a clean, production-ready server block for Nginx without you having to remember every directive by heart. You fill in your domain, point it at a document root or an upstream app, toggle the features you need, and the tool writes a correctly indented configuration in real time. It is aimed at developers, sysadmins, and anyone deploying a site or app who wants a sane starting .conf instead of copy-pasting fragments from a dozen blog posts.

Everything is generated in your browser. The domain names, certificate paths, socket paths, and upstream addresses you type are never sent anywhere — there is no API call, no account, and no logging on our side. You can copy the result to your clipboard or download it as a .conf file named after your server, then drop it into sites-available or nginx.conf.

Start from a preset, then customize

Seven presets cover the most common deployments and pre-fill the relevant options so you are not toggling switches blind:

  • Static Site — plain HTML/CSS/JS with gzip and asset caching
  • WordPress — PHP-FPM, a 64m upload limit, and SAMEORIGIN framing
  • Node.js and Next.js — reverse proxy to 127.0.0.1:3000 with WebSocket upgrade headers
  • Laravel — PHP-FPM rooted at /public with try_files to index.php
  • Django — reverse proxy to a Gunicorn upstream on port 8000
  • SPA (React/Vue)try_files history fallback to index.html so client-side routing works

After picking a preset you can still change any value; the output updates as you type.

What it can generate

The generator covers the directives that matter for a real deployment:

  • HTTPS / SSLlisten 443 ssl http2, certificate and key paths, TLS 1.2/1.3, a hardened cipher suite, session cache, optional HSTS with preload, and OCSP stapling.
  • Reverse proxyproxy_pass to your upstream with X-Real-IP, X-Forwarded-For, X-Forwarded-Proto, and Host headers, plus Upgrade/Connection headers when WebSocket support is enabled.
  • PHP-FPM — a location ~ \.php$ block wired to your FastCGI socket with the standard fastcgi_params.
  • Performance — gzip (level 6, gzip_min_length 256) and per-type expires plus Cache-Control headers for images, CSS, and JS.
  • SecurityX-Frame-Options, X-Content-Type-Options: nosniff, Referrer-Policy, an optional Content-Security-Policy, request body size limits, and a block that denies access to hidden dotfiles.
  • Rate limiting — a limit_req directive in the server block, with the matching limit_req_zone shown as a comment because that line belongs in the http context.
  • Redirects — automatic HTTP-to-HTTPS, www/non-www canonicalization, and your own 301 or 302 rewrite rules.

Why a generated config beats hand-editing

Nginx configuration is unforgiving: a missing semicolon, a directive in the wrong context, or a forgotten try_files line can take a site offline or silently break SPA routing. Generating the block keeps the structure valid and the indentation consistent, and it nudges you toward defaults people often miss — HTTP/2, modern TLS only, security headers marked always, and turning off access logs for static assets to cut log noise.

One detail worth knowing: the limit_req_zone directive must live in the http block, not inside server, which is exactly why the tool emits it as a labeled comment rather than burying it where it would fail to load. Before you go live, always validate with nginx -t and reload with nginx -s reload (or systemctl reload nginx). Treat the output as a strong, opinionated starting point — review the paths, certificates, and upstream addresses against your own server before deploying.