# Main context
worker_processes auto; # Automatically determine worker processes based on CPU cores

events {
    worker_connections 1024; # Maximum connections per worker
}

http {
    default_type  application/octet-stream;
    # Trust the custom Docker network subnet
    set_real_ip_from 0.0.0.0;
    real_ip_header X-Forwarded-For;
    real_ip_recursive on;

    server {
        listen 8080;
        server_name <domain>.<com>;

        root /app;
        index index.html;

        location / {
            try_files $uri $uri/ /index.html;
        }

    location ~* \.js$ {
        types { application/javascript js; }
        default_type application/javascript;
    }

    # Serve CSS files with the correct MIME type
    location ~* \.css$ {
        types { text/css css; }
        default_type text/css;
    }

    # Serve image files
    location ~* \.(png|jpe?g|webp|ico)$ {
        expires 6M; # Optional: Cache static assets for 6 months
        access_log off;
    }

    }
}

