nginx缓存代理服务器
1,何为缓存代理服务器:在代理服务器的基础上添加缓存功能,使在访问过程中可直接访问缓存,降低成本。
2,配置
在已配置好代理服务器的基础上配置下面操作,代理服务器配置:https://blog.csdn.net/weixin_56722308/article/details/116502792?spm=1001.2014.3001.5502
(1)在nginx主配置文件中:
vim /etc/nginx/nginx.conf
中的http{}中添加:
http{
proxy_cache_path /app/ying/cache levels=1:2 keys_zone=proxy_cache:10m max_size=10g inactive=60m use_temp_path=off;
#缓存的本地目录 ,两个层次文件目录,共享内存区名称(记住下面要用)10M大小,最大缓存大小10G,缓存时间60分,关闭临时存储区域。
...
}
(2)调用,在子配置文件中
vim /etc/nginx/conf.d/default.conf
中的location / {}添加:
server{
location /{
proxy_cache proxy_cache; #调用缓存(内存区名称)
prox