# Define the server block for your domain/IP
server {
    # Listen for HTTP requests on port 80
    listen 80;
    # Server name (replace with your domain or server IP)
    server_name yourdomain.com www.yourdomain.com;
 
    # Define how to handle requests to the root URL (/)
    location / {
        # Proxy requests to the backend server (e.g., Node.js app on localhost:3000)
        proxy_pass http://localhost:3000;
        
        # Forward important headers to the backend server
        proxy_set_header Host $host;           # Pass the original host header
        proxy_set_header X-Real-IP $remote_addr; # Pass the client's real IP
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Track proxy chain
        proxy_set_header X-Forwarded-Proto $scheme; # Pass the protocol (HTTP/HTTPS)
    }
}