upstream sigi_app_server {
    server unix:/srv/interlegis/socks/sigi.sock fail_timeout=0;
}

server {
    listen 80;
    server_name sigih.interlegis.leg.br;

    client_max_body_size 4G;

    proxy_read_timeout 300;
    proxy_connect_timeout 300;
    proxy_send_timeout 300;

    access_log /var/log/sigi/sigi-access.log;
    error_log /var/log/sigi/sigi-error.log;

    location /static/ {
        alias /srv/interlegis/sigi/static/;
    }

    location /media/ {
        alias /srv/interlegis/sigi/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://sigi_app_server;
            break;
        }
    }
}