upstream app_server {
    server web:8000;
}

server {
    listen 80;
    listen [::]:80;
    server_name _;

    client_max_body_size 100M;

    location /static/ {
        alias /usr/src/app/static/;
        expires 30d;
        add_header Cache-Control "public, max-age=2592000";
    }

    location /media {
        alias /usr/src/app/media;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;
        proxy_redirect off;
        proxy_buffering off;
        proxy_pass http://app_server;
    }
}
