Nginx Config Generator
Free online Nginx configuration file generator. Build server blocks with SSL, reverse proxy, gzip, security headers, WebSocket support, and more — no manual editing required.
server {
listen 80;
server_name example.com;
client_max_body_size 10M;
root /var/www/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}What Is an Nginx Config Generator?
Nginx is one of the most widely used web servers and reverse proxies on the internet, powering a significant share of all websites. Its configuration is done through plain-text files that define how incoming HTTP requests are handled — which domains to serve, where to forward traffic, how to terminate SSL, and what security headers to include. An Nginx Config Generator lets you fill in a simple form and instantly produces a valid, production-ready nginx server block configuration. Instead of remembering directive names and indentation rules, you toggle options and get a copy-pasteable config file in seconds.
How to Use the Nginx Config Generator
- Enter your domain name in the Server Name field (e.g., 'example.com' or 'api.mysite.com').
- Set the listen port — usually 80 for HTTP or 443 for HTTPS.
- Enable SSL/HTTPS if you have an SSL certificate, then provide the certificate and key file paths.
- Turn on HTTP → HTTPS Redirect to automatically redirect all HTTP traffic to the secure port.
- Enable Reverse Proxy if Nginx should forward requests to a backend application, and set the Proxy Pass URL.
- Toggle WebSocket Support, Gzip Compression, and Security Headers as needed.
- Configure the root directory, index files, and client max body size for your use case.
- Copy the generated config and paste it into your Nginx sites-available directory.
Common Use Cases
- Reverse Proxy for Node.js / Python Apps — Generate a config that proxies requests from port 80/443 to a backend running on localhost:3000, localhost:8000, or any other port. Includes proper proxy headers for real IP forwarding.
- SSL Termination with Let's Encrypt — Quickly create a server block with SSL certificate paths, modern TLS protocols (TLSv1.2, TLSv1.3), and an automatic HTTP-to-HTTPS redirect for secure websites.
- Static Site Hosting — Set up Nginx to serve static HTML, CSS, and JavaScript files from a root directory with proper index file configuration and try_files fallback.
- WebSocket Proxy — Configure Nginx to correctly proxy WebSocket connections by upgrading the HTTP connection, essential for real-time applications, chat systems, and live dashboards.
- Security Hardening — Add essential security headers — X-Frame-Options, X-Content-Type-Options, X-XSS-Protection, Referrer-Policy, and Content-Security-Policy — with a single toggle.