Nginx Config Generator

Generate production nginx server blocks with SSL, proxy_pass, WebSocket support, security headers, gzip and rate limiting.

Pay by wallet (x402) AI-generated nginx-config-generate

Example

Input
{
  "domain": "google.com"
}
Answer
{
  "notes": [
    "Ensure Let's Encrypt certificate exists at /etc/letsencrypt/live/google.com/ before deploying",
    "Update root directory path /var/www/google.com/public to match your application structure",
    "Upstream service must be running on localhost:3000",
    "HSTS header includes preload flag - only add if domain is in HSTS preload list",
    "SSL session cache uses shared memory for better performance across worker processes",
    "WebSocket upgrade headers ensure proper bidirectional communication",
    "Gzip compression excludes compressed formats to avoid double-compression overhead",
    "Consider adjusting proxy timeouts based on application response times",
    "Access logs can be disabled for health check endpoint to reduce log noise",
    "Certificate renewal with Let's Encrypt certbot is required every 90 days"
  ],
  "config": "# HTTP redirect to HTTPS\nserver {\n    listen 80;\n    listen [::]:80;\n    server_name google.com www.google.com;\n    return 301 https://$server_name$request_uri;\n}\n\n# WWW redirect to non-WWW\nserver {\n    listen 443 ssl http2;\n    listen [::]:443 ssl http2;\n    server_name www.google.com;\n\n    ssl_certificate /etc/letsencrypt/live/google.com/fullchain.pem;\n    ssl_certificate_key /etc/letsencrypt/live/google.com/privkey.pem;\n\n    return 301 https://google.com$request_uri;\n}\n\n# Main server block\nserver {\n    listen 443 ssl http2;\n    listen [::]:443 ssl http2;\n    server_name google.com;\n\n    # SSL Configuration\n    ssl_certificate /etc/letsencrypt/live/google.com/fullchain.pem;\n    ssl_certificate_key /etc/letsencrypt/live/google.com/privkey.pem;\n    ssl_protocols TLSv1.2 TLSv1.3;\n    ssl_ciphers HIGH:!aNULL:!MD5;\n    ssl_prefer_server_ciphers on;\n    ssl_session_cache shared:SSL:10m;\n    ssl_session_timeout 10m;\n\n    # Gzip Compression\n    gzip on;\n    gzip_vary on;\n    gzip_min_length 1000;\n    gzip_proxied any;\n    gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/atom+xml image/svg+xml application/json;\n    gzip_disable \"msie6\";\n\n    # Security Headers\n    add_header Strict-Transport-Security \"max-age=31536000; includeSubDomains; preload\" always;\n    add_header X-Frame-Options \"SAMEORIGIN\" always;\n    add_header X-Content-Type-Options \"nosniff\" always;\n    add_header Referrer-Policy \"strict-origin-when-cross-origin\" always;\n    add_header X-XSS-Protection \"1; mode=block\" always;\n    add_header Permissions-Policy \"geolocation=(), microphone=(), camera=()\" always;\n\n    # Logging\n    access_log /var/log/nginx/google.com.access.log;\n    error_log /var/log/nginx/google.com.error.log;\n\n    # Root location\n    root /var/www/google.com/public;\n\n    location / {\n        proxy_pass http://localhost:3000;\n        \n        # Proxy Headers\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_set_header X-Forwarded-Host $server_name;\n\n        # WebSocket Support\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n\n        # Timeouts\n        proxy_connect_timeout 60s;\n        proxy_send_timeout 60s;\n        proxy_read_timeout 60s;\n\n        # Buffering\n        proxy_buffering on;\n        proxy_buffer_size 4k;\n        proxy_buffers 8 4k;\n        proxy_busy_buffers_size 8k;\n    }\n\n    # Health check endpoint (optional)\n    location /health {\n        proxy_pass http://localhost:3000;\n        access_log off;\n    }\n}",
  "domain": "google.com",
  "upstream_port": 3000,
  "features_enabled": [
    "SSL/TLS with Let's Encrypt",
    "HTTP to HTTPS redirect",
    "WWW to non-WWW redirect",
    "WebSocket support",
    "Gzip compression",
    "HTTP/2 support",
    "Security headers (HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, X-XSS-Protection, Permissions-Policy)",
    "Proxy headers (X-Real-IP, X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Host)",
    "Connection pooling and buffering",
    "Request timeouts",
    "Logging"
  ],
  "security_headers_included": [
    "Strict-Transport-Security (HSTS)",
    "X-Frame-Options",
    "X-Content-Type-Options",
    "Referrer-Policy",
    "X-XSS-Protection",
    "Permissions-Policy"
  ]
}

Inputs

FieldTypeRequiredWhat it is
sslbooleanNo—
gzipbooleanNo—
domainstringYes—
rate_limitintegerNo—
www_redirectbooleanNo—
upstream_portintegerNo—

Output fields

How reliably each field appears in a successful answer.

FieldTypeAppears
notesarrayAlways (present in every successful answer)
configstringAlways (present in every successful answer)
features_enabledarrayAlways (present in every successful answer)
security_headers_includedarrayAlways (present in every successful answer)

How to call it

The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.

# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
  -H "Authorization: Bearer $STRALE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "capability_slug": "nginx-config-generate",
    "inputs": {
      "domain": "google.com"
    },
    "max_price_cents": 5
  }'

Limitations

  • Custom modules and OpenResty blocks are not supported

    Generates standard nginx configurations — complex setups with custom modules or OpenResty/Lua blocks are not supported

    What to do instead: Use the generated config as a base template and add custom directives for your specific nginx modules