NGINX Config Generator

Generate production-ready NGINX configurations for static sites, SPAs, PHP, Node.js, reverse proxies, and load balancers.

Server Type

Basic Settings

SSL / HTTPS

Security & Performance

nginx.conf

# NGINX Configuration
# Generated for: example.com
# Type: static

# Redirect HTTP to HTTPS
server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;
    return 301 https://$server_name$request_uri;
}

# Main server block
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name example.com www.example.com;
    root /var/www/html;

    # SSL Configuration
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 1d;
    ssl_session_tickets off;

    # HSTS
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;

    # Security Headers
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;

    # Logging
    access_log /var/log/nginx/example.com.access.log;
    error_log /var/log/nginx/example.com.error.log;

    # Gzip Compression
    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;

    # Static Site Configuration
    index index.html index.htm;

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

    # Static Asset Caching
    location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2|ttf|svg|eot)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }
}

What is This Tool?

An Nginx config generator builds nginx.conf configurations with a visual editor. Configure server blocks, reverse proxies, SSL/TLS, caching, rate limiting, and security headers, then export production-ready Nginx configuration files.

Nginx powers over 30% of the web as both a web server and reverse proxy. Configuration involves server blocks (virtual hosts), location blocks (URL routing), upstream blocks (backend servers), and directive inheritance. Correct SSL, security header, and caching configuration is critical for performance and security.

Common Use Cases

Reverse Proxy Setup

Configure Nginx as a reverse proxy for Node.js, Python, Go, and other backend applications with proper headers and timeouts.

SSL/TLS Configuration

Generate secure SSL configurations with modern cipher suites, OCSP stapling, and HTTP/2 support.

Static Site Hosting

Configure efficient static file serving with gzip compression, cache headers, and SPA routing fallbacks.

Load Balancing

Set up upstream server groups with round-robin, least connections, or IP hash load balancing strategies.

Frequently Asked Questions

Is the generated config production-ready?

Generated configs follow Nginx best practices with security headers, optimized buffers, and proper error handling. Review and adjust for your specific environment.

Is SSL/TLS configured securely?

Yes. Generated SSL configs use TLS 1.2+ only, modern cipher suites, HSTS headers, and OCSP stapling following Mozilla's recommendations.

How do I test the config?

Run nginx -t to validate syntax before reloading. The generated config includes comments explaining each directive.