Nginx Config Generator
Generate Nginx server block configuration visually. Configure HTTPS, reverse proxy, static files, gzip, rate limiting, and security headers.
Basic Settings
HTTPS / SSL
Performance & Security
Custom Location Blocks
No extra location blocks added.
What Is an Nginx Server Block?
An Nginx server block (equivalent to Apache's VirtualHost) defines how Nginx handles requests for a specific domain or IP. Each server block specifies a domain name, listen port, root directory, and how to route different URL paths — whether to serve static files, forward requests to a backend, or process PHP via FastCGI.
How to Use
- Select your server type: Static, Reverse Proxy, or PHP-FPM
- Enter your domain name and root directory
- Enable HTTPS to include SSL configuration (requires cert paths)
- Toggle performance and security options as needed
- Copy the generated config to
/etc/nginx/sites-available/yourdomain.conf - Symlink to sites-enabled and run
nginx -t && systemctl reload nginx
Server Type Guide
- Static: Serve HTML/CSS/JS directly from the filesystem — ideal for SPAs and static sites
- Reverse Proxy: Forward requests to a Node.js, Python, or other backend server
- PHP-FPM: Process PHP files via FastCGI — used for WordPress, Laravel, etc.
FAQ
Where do I put the generated config?
Save it to /etc/nginx/sites-available/yourdomain.conf, then create a symlink: ln -s /etc/nginx/sites-available/yourdomain.conf /etc/nginx/sites-enabled/. Test with nginx -t before reloading.
What about the http context directives (gzip, rate limit)?
Gzip and rate limit zone directives must live inside the http { } block in your main nginx.conf — not inside the server block. The generator separates these at the top of the output with a comment.
How do I get a free SSL certificate?
Use Certbot with Let's Encrypt: certbot --nginx -d yourdomain.com. It will automatically obtain and install certificates, and the paths will match the default cert paths in this generator.
What is rate limiting used for?
Rate limiting protects your server from brute-force attacks, DDoS attempts, and API abuse by capping the number of requests a single IP can make per second.