我有 2 台服务器,一台 apache,一台 nginx。
我设置 nginx 作为代理
location / {
proxy_pass http://apachesample.com:8080/;
include /etc/nginx/conf.d/proxy.conf;
proxy_buffering off;
proxy_cache web-cache;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
// try to add this section to add header and cache image
location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
expires max;
add_header Pragma public;
#add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
}
当我尝试添加 expries 标题时,没有找到所有图像?
如何设置图像的缓存过期标头?我必须在 Apache 服务器上执行此操作吗?
修复:启用 mod_rewrite