1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
proxy_cache_path cache levels=1:2 keys_zone=cache_temp:10m;
upstream cache_server { server ip|domian:8009; server ip|domain:8010; }
server { listen 96;
if ( $request_uri ~ \.(txt|text)$ ) { set $no_cache "no cache"; }
location / { proxy_cache cache_temp; proxy_cache_valid 200 5m; proxy_cache_key $host$request_uri; proxy_no_cache $no_cache; add_header Nginx-cache-status $upstream_cache_status; proxy_pass http://cache_server; proxy_cache_lock on; proxy_cache_lock_timeout 5s; proxy_cache_lock_age 5s; proxy_cache_use_stale error timeout updating; proxy_cache_background_update on; } }
|