# /etc/nginx/sites-available/brand-manual.conf
#
# Alternative to Caddy if you already run nginx elsewhere on this box.
# TLS via certbot (Let's Encrypt) -- run this AFTER nginx is serving
# plain HTTP successfully:
#
#   sudo certbot --nginx -d brands.yourdomain.com
#
# certbot will rewrite this file to add the SSL block automatically.
# Enable with: sudo ln -s /etc/nginx/sites-available/brand-manual.conf
#              /etc/nginx/sites-enabled/ && sudo nginx -t && sudo systemctl reload nginx

server {
    listen 80;
    server_name brands.yourdomain.com;

    # Logo/font uploads + generated PDFs can be a few MB -- nginx's
    # default 1MB body limit will silently 413 uploads without this.
    client_max_body_size 15M;

    # PDF generation (Playwright + compositing) can take a few seconds
    # under load -- default proxy timeouts are often too tight for that.
    proxy_read_timeout 90s;
    proxy_connect_timeout 90s;

    location / {
        proxy_pass http://127.0.0.1:8000;
        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;
    }
}
