Nginx Config Generator
Generate production-ready nginx server block configurations visually. Choose from presets for Static Site, WordPress, Laravel, Node.js, React SPA, Django, and API Gateway. Toggle SSL, security headers, gzip, FastCGI caching, and rate limiting.
Basic Settings
SSL / TLS
Security Headers
Performance
PHP / FastCGI Cache
Rate Limiting
What is an Nginx Config Generator?
An nginx config generator produces ready-to-use server { } blocks without requiring you to memorise directive syntax. Nginx is an event-driven web server that handles thousands of concurrent connections with minimal memory - making it the most widely deployed web server for production PHP, Node.js, Python, and static-site hosting. Configuring it correctly involves SSL cipher suites, FastCGI parameters, security headers, and caching directives that are easy to get wrong.
Presets explained
Static Site uses try_files $uri $uri/ =404 to serve files directly from disk with optional gzip and long-lived browser cache headers. React / Vue SPA adds a /index.html fallback so client-side routing works for deep links. WordPress and Laravel configure a fastcgi_pass to PHP-FPM and block access to sensitive paths. Node.js, Django, and API Gateway use proxy_pass with the correct upstream headers so the backend receives the real client IP.
Frequently Asked Questions
How do I apply this config on my server?
Save the output to /etc/nginx/sites-available/example.com.conf, create a symlink in sites-enabled/, then run nginx -t to test and nginx -s reload to apply without downtime. Do not restart nginx - reload applies changes gracefully.
Where do the SSL certificate paths come from?
The generated paths (/etc/letsencrypt/live/example.com/fullchain.pem) match the standard Let's Encrypt / Certbot layout. Run certbot --nginx -d example.com and Certbot will provision the certificates at those paths automatically.
What is FastCGI microcaching and why does it matter?
FastCGI microcaching stores PHP-generated responses in nginx's memory for 1–5 seconds. Even a 1-second cache means a traffic spike hits the cache, not PHP-FPM - reducing response times from 200 ms to under 10 ms and CPU usage by up to 80%. Anonymous visitors get cached pages; logged-in users bypass the cache via cookie detection in more advanced setups.
Why add the http block directives as comments?
Directives like fastcgi_cache_path and limit_req_zone must appear in the http { } context, not inside a server { } block. This generator outputs them as comments so you know exactly what to add to your main nginx.conf before referencing them in the server block.
Does nginx support .htaccess files?
No. Nginx does not read .htaccess files - all configuration must be in the main config files. If you are migrating from Apache, use the .htaccess Generator to see Apache syntax side-by-side, then translate the rules into nginx location blocks.
What does HSTS do and should I enable it?
HTTP Strict Transport Security tells browsers to always use HTTPS for your domain for the next year, skipping the initial HTTP request that is vulnerable to interception. Only enable it once your SSL setup is stable - an HSTS header with includeSubDomains will break any subdomain that serves HTTP, and it cannot be easily undone once cached by browsers.