修改配置文件,在http段添加:
proxy_cache_path /path/proxy_cache levels=1:2 keys_zone=cache_one:30m inactive=10d max_size=10g;
#定义缓存名称cache_one,2级目录,内存缓存30M,硬盘10G,10未访问内容删除
proxy_temp_path /path/proxy_tmp;
server段配置:
server {
listen 3128;
resolver 8.8.8.8;
proxy_cache cache_one;
proxy_max_temp_file_size 10m;
location / {
proxy_pass http://$host$request_uri;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
}
location ~ .*\.(php|jsp|cgi|asp)?$ {
proxy_pass http://$host$request_uri;
}
}
Iptables配置
iptables -tnat -APREROUTING -ibr-lan -ptcp --dport80-jREDIRECT --to-ports3128
本文转自gaodi2002 51CTO博客,原文链接:http://blog.51cto.com/gaodi2002/1617416