我的nginx服务器配置如下:
......
server {
# Status page
location /nginx_originserver {
stub_status on;
}
listen 80;
location ~ ^/1 {
proxy_pass http://10.10.52.126:1239;
proxy_cache api_cache;
}
......
}
在这种情况下,当我浏览
http://localhost/1/thumbnail.jpg
时,图像文件被缓存。但是当我更改代理到返回json
的位置并浏览http://localhost/1/api_service
时,json文件没有被缓存,为什么只有图像文件被缓存而不是json文件,如何缓存json文件?location ~ ^/1 {
proxy_pass http://10.10.52.126:8090;
proxy_cache api_cache;
}