Nginx & Apache Reverse Proxy Config Builder

Client-SideOffline Ready

Visual configuration generator for production-ready Nginx and Apache reverse proxies with WebSocket support, Let's Encrypt SSL, HSTS, CORS, and Gzip compression.

App Preset:
Local loopback IP or internal Docker host
Port your application server is listening on

SSL / TLS Encryption

HTTP → HTTPS 301 Redirect
HSTS (Strict-Transport-Security)

Reverse Proxy Capabilities

WebSocket Protocol Upgrade
HTTP/1.1 Upgrade & Connection headers
OWASP Security Headers
X-Frame-Options, nosniff, Referrer-Policy
Gzip Dynamic Compression
Compress text, JSON, CSS, and SVG on-the-fly
Rate Limiting Zone
Protect API from abusive brute-force requests
CORS Response Headers
Cross-Origin Resource Sharing for API gateways

app.example.com.conf

# =========================================================================
# Nginx Reverse Proxy Configuration for app.example.com
# Generated by AgentXAlpha Config Builder (2026-10-28)
# =========================================================================

# WebSocket Upgrade connection map
map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
    listen 80;
    listen [::]:80;
    server_name app.example.com;

    # ACME Challenge location for Let's Encrypt automated renewals
    location ^~ /.well-known/acme-challenge/ {
        root /var/www/html;
    }

    # Redirect all plain HTTP requests permanently to HTTPS
    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name app.example.com;

    # SSL / TLS Certificate paths
    ssl_certificate /etc/letsencrypt/live/app.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/app.example.com/privkey.pem;

    # Mozilla Intermediate TLS Configuration
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:10m;
    ssl_session_tickets off;

    # Maximum allowed request payload size
    client_max_body_size 50M;

    # Hardened Security Response 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;
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;

    # Gzip Dynamic 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 image/svg+xml;

    # Cache static media, fonts, and stylesheets directly
    location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
        proxy_pass http://127.0.0.1:3000;
        expires 30d;
        add_header Cache-Control "public, no-transform";
    }

    location / {
        # Upstream proxy pass
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;

        # Forward authentic client connection headers
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;

        # WebSocket protocol upgrade support
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;

        # Upstream gateway timeouts
        proxy_connect_timeout 60s;
        proxy_send_timeout    60s;
        proxy_read_timeout    60s;
    }
}
Deploy & Test Commands:Run as root / sudo
sudo nginx -t && sudo systemctl reload nginx

Production-Hardened Defaults

Generates battle-tested Nginx and Apache reverse proxy rules conforming to Mozilla Modern SSL, standard proxy headers, and OWASP security recommendations.

Full WebSocket & HTTP/2 Support

Seamlessly generates HTTP/1.1 Upgrade and Connection headers for full-duplex WebSockets, socket.io, and real-time streaming engines.

Zero-Server Client Privacy

All configuration templates and domain parameters are generated entirely on-device in your browser. No server addresses or domains are tracked or logged.

Frequently Asked Questions

Why do I need proxy_set_header Host $host in Nginx reverse proxies?
By default, Nginx overrides the incoming Host header with the address of the upstream server (e.g. localhost:3000). Setting "proxy_set_header Host $host;" preserves the client’s original domain name, which is essential for multi-tenant apps, SSL validation, OAuth redirects, and link generation.
How do WebSockets work through an Nginx reverse proxy?
Because the WebSocket handshake starts as an HTTP/1.1 request with "Upgrade: websocket" and "Connection: Upgrade" headers, an Nginx reverse proxy must explicitly declare "proxy_http_version 1.1;", "proxy_set_header Upgrade $http_upgrade;", and "proxy_set_header Connection $connection_upgrade;". Without these, Nginx terminates the connection as standard HTTP.
Where should I save the generated configuration on my Linux server?
For Nginx on Debian/Ubuntu, place the file in /etc/nginx/sites-available/your-domain.conf and symlink it to /etc/nginx/sites-enabled/. On RHEL/CentOS, place it in /etc/nginx/conf.d/your-domain.conf. For Apache, place it in /etc/apache2/sites-available/your-domain.conf and enable it with a2ensite your-domain.conf.
How do I test my configuration before reloading Nginx or Apache?
Always test configuration syntax before applying it to prevent downtime: run "sudo nginx -t" for Nginx, or "sudo apache2ctl configtest" (or "httpd -t") for Apache.
Recommended For You

More Dev Tools Utilities

View all Dev Tools tools