server {
    listen 80;
    server_name localhost;
    
    # Increase client_max_body_size to allow larger uploads (e.g. 100M)
    client_max_body_size 100M;

    location / {
        root /usr/share/nginx/html;
        index index.html index.htm;
        try_files $uri $uri/ /index.html;
    }

    # Proxy API requests to backend
    # Assuming backend service is named 'backend' in docker-compose or similar network
    # For standalone docker build, this might need configuration via env vars or manual setup
    location /api {
        proxy_pass http://backend:80;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    # Proxy uploads to backend (if served by backend)
    location /uploads {
        proxy_pass http://backend:80;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    # Proxy static files to backend (e.g. for uploaded images served via static)
    location /static {
        proxy_pass http://backend:80;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}
