# Softswitch Portal - Standalone Nginx Configuration
# Use this when Portal is installed on a separate server

server {
    listen 80;
    server_name _;

    access_log /var/log/nginx/portal_access.log;
    error_log /var/log/nginx/portal_error.log;

    # API proxy (to Admin/API Server)
    # Update ADMIN_SERVER_IP with your Admin server IP
    location /api/ {
        proxy_pass http://ADMIN_SERVER_IP:3001;
        
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        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_read_timeout 300s;
        client_max_body_size 100M;
    }

    # Portal Application (root)
    location / {
        root /var/www/softswitch/portal;
        index index.html;
        try_files $uri $uri/ /index.html;
    }
}
