Nginx Configuration

Configure Nexting with Nginx reverse proxy.

Basic Configuration

Add these location blocks to your Nginx server configuration:

nginx.conf
server {
    listen 80;
    server_name yourdomain.com;

    # Proxy verification endpoint
    location = /__verify__ {
        proxy_pass https://api.nexting.ai/proxy/YOUR_KEY/__verify__;
        proxy_set_header Host api.nexting.ai;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_ssl_server_name on;
    }

    # Proxy all /blog paths
    location /blog/ {
        proxy_pass https://api.nexting.ai/proxy/YOUR_KEY/blog/;
        proxy_set_header Host api.nexting.ai;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_ssl_server_name on;
    }

    # Your other location blocks...
    location / {
        # your existing config
    }
}

SSL Note

The proxy_ssl_server_name on directive is required for HTTPS backends with SNI.

With Caching

Add caching to reduce load on the proxy:

nginx.conf
# Define cache zone (add to http block)
proxy_cache_path /var/cache/nginx/nexting levels=1:2 keys_zone=nexting:10m max_size=100m inactive=60m;

server {
    # ...

    location /blog/ {
        proxy_pass https://api.nexting.ai/proxy/YOUR_KEY/blog/;
        proxy_set_header Host api.nexting.ai;
        proxy_ssl_server_name on;

        # Enable caching
        proxy_cache nexting;
        proxy_cache_valid 200 5m;
        proxy_cache_use_stale error timeout updating;
        add_header X-Cache-Status $upstream_cache_status;
    }
}

Related Guides