修改配置檔案,在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_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
}
location ~ .*\.(php|jsp|cgi|asp)?$ {
}
}
Iptables配置
iptables -tnat -APREROUTING -ibr-lan -ptcp --dport80-jREDIRECT --to-ports3128
本文轉自gaodi2002 51CTO部落格,原文連結:http://blog.51cto.com/gaodi2002/1617416