upstream lutris_server {
    server unix:/srv/lutris/run/gunicorn.sock fail_timeout=0;
}

server {
    listen 80;
    server_name dev.lutris.net;

    client_max_body_size 4G;

    access_log /srv/lutris/logs/nginx-access.log;
    error_log /src/lutris/logs/nginx-error.log;

    location /static/ {
        alias /srv/lutris/lutris.net/static/;
    }

    location /media/ {
        alias /srv/lutris/lutris.net/media/;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        if (!-f $request_filename) {
            proxy_pass http://lutris_server;
            break;
        }
    }

    error_page 500 502 503 504 /500.html;
    location = /500.html {
        root /srv/lutris/lutris.net/templates/;
    }
}
