Answer the question
In order to leave comments, you need to log in
Nginx doesn't cache long URLs
Nginx stubbornly refuses to cache long URLs. Namely, the request:
1.1.1.1 - - [17/Feb/2012:06:10:21 +0000] "www2.website.com" "GET /zone=1470382351&lp=1468664992&var1=www2V4anothersiteSite&path=/de/live-game/&src=LC&selected_slide_name=1468664992&p_path=/de/live-game/ HTTP/1.0" 302 - "http://www2.website.com/de" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729)" 131666
Regularly proxied to Apaches, and not cached by ngix. Everything else seems to be cached normally.
What can be a rake?
proxy_cache_path /webcache/www2 levels=1:2 keys_zone=www2-cache:8m max_size=1000m inactive=600m;
proxy_temp_path /webcache/www2/tmp;
location /shared/css {
root /home/nginx/public;
expires 1d;
#access_log off;
}
location /shared/js {
root /home/nginx/public;
expires 1d;
#access_log off;
}
location /js {
root /home/nginx/public/www2;
expires 1d;
#access_log off;
}
location /skin/default {
root /home/nginx/public/www2;
expires 3d;
#access_log off;
}
#location ~ ^.+\.(swf|jpg|jpeg|gif|png|ico|css|js|tmpl)$ {
# root /home/nginx/public/www2;
# expires 3d;
#access_log off;
# }
location / {
proxy_pass www2;
proxy_cache www2-cache;
proxy_cache_valid 200 30m;
proxy_cache_valid 302 30m;
proxy_cache_valid 304 30m;
proxy_cache_valid any 10m;
}
Answer the question
In order to leave comments, you need to log in
Try changing the proxy_cache_key value.
For example, I use proxy_cache_key "$request_method|$http_if_none_match|$host|$uri$args"
ps By the way, try adding '"$upstream_addr" "$upstream_response_time" "$upstream_status" $upstream_cache_status' to the access log, it will be it is more convenient to debug caching.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question