- 论坛徽章:
- 0
|
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -s 192.168.0.0/16 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -d 0.0.0.0/0 -j MASQUERADE
tar xzvf squid-2.6.STABLE6.tar.gz
cd squid-2.6.STABLE6
./configure --prefix=/usr/local/squid --enable-dlmalloc --with-pthreads --enable-poll --disable-internal-dns --enable-stacktrace --enable-removal-policies="heap,lru" --enable-delay-pools --enable-storeio="aufs,coss,diskd,ufs"
make
make install
修改squid.conf
hierarchy_stoplist -i ^https:\\ ?
acl QUERY urlpath_regex -i cgi-bin \? \.asp \.php \.jsp \.cgi
acl denyssl urlpath_regex -i ^https:\\
no_cache deny QUERY
no_cache deny denyssl
maximum_object_size 20000 KB
maximum_object_size_in_memory 4096 KB
ipcache_size 1024
ipcache_low 90
ipcache_high 95
fqdncache_size 1024
cache_access_log /var/squid/logs/access.log
cache_log /var/squid/logs/cache.log
cache_store_log none
emulate_httpd_log on
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
ftp_user Squid@
ftp_passive on
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
coredump_dir /var/squid/cache
logfile_rotate 90
cache_dir ufs /var/squid/cache 4096 16 256
cache_mem 256 MB
cache_swap_low 80
cache_swap_high 95
cache_effective_user squid
cache_effective_group squid
http_port 3128 transparent
#acl tianya referer_regex -i tianya
#http_access deny tianya
#deny_info tianya
acl AntiBaidu req_header User-Agent Baiduspider
http_access deny AntiBaidu
acl Manager proto cache_object
acl Localhost src 127.0.0.1 192.168.104.1
http_access allow Manager Localhost
http_access deny Manager
acl Safe_ports port 80 # http
acl Safe_ports port 443
http_access deny !Safe_ports
acl all src 0.0.0.0/0.0.0.0
http_access allow all
visible_hostname www.test137.com
cache_mgr dli@99bill.com
cache_effective_user squid
cache_effective_group squid
tcp_recv_bufsize 65535 bytes
error_directory /usr/local/squid/share/errors/Simplify_Chinese
icp_port 0
第一次发自己整理得文档,希望版主能加精。谢谢 |
|