server { server_name localhost ; listen 80 ; location / { root /usr/share/nginx/html ; try_files $uri $uri/ /index.html ; } # nb: we access the backend server via the network bridge that docker-compose creates for us location /api { proxy_pass http://flask:5000 ; rewrite ^/api/(.*) /$1 break ; # NOTE: The frontend and backend containers will be running on the same host. If we can't connect # within a few seconds, something's wrong and there's nothing to be gained by having longer timeouts. proxy_connect_timeout 10 ; proxy_read_timeout 10 ; proxy_send_timeout 10 ; } location /user { proxy_pass http://flask:5000 ; rewrite ^/user/(.*) /user-files/$1 break ; } error_page 500 502 503 504 /50x.html ; location = /50x.html { root /usr/share/nginx/html ; } }