Skip to content

Nginx Config Generator

Generate nginx configurations for reverse proxy, SSL, static sites, and load balancers with security headers

Nginx Config Generator

Template

Basic Settings

Security Headers

Generated Config

server {
    listen 80;
    listen [::]:80;

    server_name example.com;

    root /var/www/html;
    index index.html;

    # Response headers
    add_header X-Frame-Options "DENY" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;

    # Gzip compression
    gzip on;
    gzip_vary on;
    gzip_min_length 1024;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml image/svg+xml;

    location / {
        try_files $uri $uri/ =404;
    }
}

Last updated:

This tool is provided as-is for convenience. Output should be verified before use in any production or critical context.

For AI agents: how to call this tool

Machine-readable contract, endpoints and examples. Humans can ignore this section.

Best Path For Builders

Browser workflow

Runs instantly in the browser with private local processing and copy/export-ready output.

Browser Workflow

This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.

/nginx-config-generator/

For automation planning, fetch the canonical contract at /api/tool/nginx-config-generator.json.

How to Use Nginx Config Generator

  1. 1

    Select server type

    Choose your use case: static site, reverse proxy, load balancer, SPA with history fallback, or API gateway.

  2. 2

    Configure upstream servers

    Add backend servers as IP:port rows. The generator writes them into an upstream block, which nginx balances round-robin by default; there is no control here for other balancing methods.

  3. 3

    Enable SSL/TLS

    Paste your certificate and key paths. The generator creates full SSL configuration with strong ciphers, HSTS headers, and redirect from HTTP.

  4. 4

    Toggle caching, gzip and rate limiting

    The location blocks come from the template you picked; the toggles add asset caching, gzip and a request-rate limit on top. There is no free-form location editor.

  5. 5

    Copy config and deploy

    Copy or download the whole config as one nginx.conf; there is no per-block export. Drop it in /etc/nginx/sites-enabled/ and run 'nginx -t' to validate before reload.

Frequently Asked Questions

What nginx configurations can this generate?
Static sites, reverse proxies, load balancers, SPA hosting (React/Vue), and API gateways — all with optional SSL/TLS, security headers, caching, gzip compression, and rate limiting.
Does it include SSL configuration?
Yes: certificate and key paths, a TLSv1.2/1.3 toggle, four ECDHE-GCM cipher suites, session cache settings, optional HSTS, an HTTP-to-HTTPS redirect server, and a Let's Encrypt certbot command.
Can I add security headers?
Yes, toggle OWASP-recommended headers including X-Frame-Options, Content-Security-Policy, X-Content-Type-Options, Referrer-Policy, and Permissions-Policy.
Does it validate the generated config?
The tool generates syntactically correct nginx configs with inline comments. For full validation, run 'nginx -t' on your server after deploying the configuration.
Is this tool free?
Free to use. Your server configuration is generated entirely in your browser and not sent to external services.