include /etc/nginx/conf.d/sub/cache-uwsgi.conf; upstream flask_server { # ip_hash; server flask_website:8080; # server flask_website:8080 weight=1 max_fails=3 fail_timeout=30s; # Or: server unix:/app/flask_server.sock; } server { listen 80; listen [::]:80; #listen 443; #listen [::]:443; server_name flask.bensuperpc.org www.flask.bensuperpc.org; include /etc/nginx/conf.d/sub/gzip.conf; location / { try_files $uri @flask_app; } location @flask_app { include uwsgi_params; uwsgi_pass flask_server; uwsgi_buffering on; uwsgi_buffers 8 16k; uwsgi_cache UWSGI; uwsgi_cache_valid 200 302 10m; uwsgi_cache_valid 301 1h; uwsgi_cache_valid any 1m; uwsgi_cache_lock on; #uwsgi_ignore_headers Cache-Control X-Accel-Expires Expires Vary Set-Cookie; #uwsgi_hide_header Vary; uwsgi_ignore_headers Vary; uwsgi_hide_header Vary; add_header X-cache $upstream_cache_status; } }