upstream geocontrib_site {
    server geocontrib:5000;
}

server {
    listen 80;
    charset utf-8;
    server_name  127.0.0.1;

    client_max_body_size 4G;

    location / {
        proxy_pass_header Set-Cookie;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_read_timeout 300s;
        proxy_redirect off;
        try_files $uri $uri/ /index.html;
        if (!-f $request_filename) {
            proxy_pass http://geocontrib_site;
            break;
        }
    }

    location /static/ {
        autoindex on;
        alias /opt/geocontrib/static/;
    }

    location /media/ {
        #autoindex on;
        alias /opt/geocontrib/media/;
    }

}

