nginx代码
proxy_cache_path /usr/local/etc/nginx/cache levels=1:2 keys_zone=my_cache:50m;
server {
listen 80;
server_name test.com;
location / {
proxy_pass http://127.0.0.1:3366;
proxy_set_header Host $host;
proxy_cache my_cache;
}
}
nodejs代码
response.writeHead(200, {
"Cache-Control": 's-maxage=20',
});
response.end('successs!');
一摸一样的代码在windows 系统就没有问题,但是在mac系统下就不行总是请求不通,但是只要删除nodejs里的Cache-Control 或者 nginx的proxy_cache my_cache; 就可以了是mac系统的nginx少什么配置吗?求助各路大神~~
先确认一下mac下路径对不对,有没有读写权限,最好查一下nginx的.log日志文件,里面有详细的错误信息