Development

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.

Free to use No sign-up Runs in your browser

Tool workspace

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

  1. 1Enter your domain name in the Server Name field (e.g., 'example.com' or 'api.mysite.com').
  2. 2Set the listen port — usually 80 for HTTP or 443 for HTTPS.
  3. 3Enable SSL/HTTPS if you have an SSL certificate, then provide the certificate and key file paths.
  4. 4Turn on HTTP → HTTPS Redirect to automatically redirect all HTTP traffic to the secure port.
  5. 5Enable Reverse Proxy if Nginx should forward requests to a backend application, and set the Proxy Pass URL.
  6. 6Toggle WebSocket Support, Gzip Compression, and Security Headers as needed.
  7. 7Configure the root directory, index files, and client max body size for your use case.
  8. 8Copy 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.

Frequently asked questions

Where do I put the generated Nginx config file?

On most Linux systems, save the config as a file in /etc/nginx/sites-available/ (e.g., /etc/nginx/sites-available/example.com), then create a symlink in /etc/nginx/sites-enabled/. Run 'nginx -t' to test the configuration and 'systemctl reload nginx' to apply it.

Do I need SSL certificates before using the SSL option?

Yes, you need valid SSL certificate and key files. You can obtain free certificates from Let's Encrypt using Certbot. The default paths in this tool point to common certificate locations, but you should update them to match your actual file paths.

Can I use this for load balancing multiple backend servers?

This generator creates a single proxy_pass directive. For load balancing across multiple upstream servers, you would need to add an 'upstream' block manually above the server block, listing your backend servers, and then set proxy_pass to the upstream name.

What does the client_max_body_size directive do?

It sets the maximum allowed size of the client request body. If a request exceeds this limit (e.g., a large file upload), Nginx returns a 413 Request Entity Too Large error. The default is 10M, but you can increase it for applications that handle large file uploads.

Why should I enable gzip compression?

Gzip compression reduces the size of HTTP responses, which decreases page load times and bandwidth usage. It is especially effective for text-based content like HTML, CSS, JavaScript, and JSON. Most modern browsers support gzip, making it a simple performance win.