由于新公司需要抓取数据,经常被封掉,而在外面买地代理却不稳定,于是俺就提出了自建代理,没想到北京8M的光纤竟然给了十来个公网ip,于是俺就在一张网卡上配置了十来个公网ip地址,然后安装squid,结果squid设定监听不同地公网ip,然而出去地ip却一直是eth0地,而不是eth0:1地ip地址,于是就按照网上说地添加了:
acl ip1 myip 114.113.221.50
tcp_outgoing_address 114.113.221.50 ip1
这样eth0:1 出去地ip也就是eth0:1地ip地址了
下面为了在一台机器上面启动多个squid于是就制作了多个配置文件,但是一定要把每个配置文件地pid,log,cache等指定到不同地位置,不然会出错地:
# Uncomment and adjust the following to add a disk cache directory.
pid_filename /usr/local/squid/var/logs/squid50.pid
cache_log /usr/local/squid/var/logs/cache50.log
access_log /usr/local/squid/var/logs/access50.log
接下来就是要设定匿名代理不然还是会被封掉:
request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access WWW-Authenticate allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access Proxy-Connection allow all
request_header_access User-Agent allow all
request_header_access Cookie allow all
request_header_access All deny all
下面贴上整个squid地配置文件:
#
# Recommended minimum configuration:
#
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow all
acl ip1 myip 114.113.221.50
tcp_outgoing_address 114.113.221.50 ip1
# Squid normally listens to port 3128
http_port 114.113.221.50:54321
# Uncomment and adjust the following to add a disk cache directory.
pid_filename /usr/local/squid/var/logs/squid50.pid
cache_log /usr/local/squid/var/logs/cache50.log
access_log /usr/local/squid/var/logs/access50.log
request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access WWW-Authenticate allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access Proxy-Connection allow all
request_header_access User-Agent allow all
request_header_access Cookie allow all
request_header_access All deny all
原文:http://www.4u45.com/?p=69
--
Posted By GFW BLOG 功夫网与翻墙 to GFW BLOG(功夫网与翻墙) at 2/07/2013 10:39:00 PM --
--
1、翻墙利器赛风3下载地址: http://dld.bz/caonima326 ,http://dld.bz/caonima745/
2、我们的订阅地址:http://feeds2.feedburner.com/chinagfwblog
3、停止订阅,请发邮件到
gfw-blog+unsubscribe@googlegroups.com
翻越防火长城,你可以到达世界上的每一个角落。(Across the Great Firewall, you can reach every corner in the world.)
---
您收到此邮件是因为您订阅了 Google 网上论坛的"GFW Blog"论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 gfw-blog+unsubscribe@googlegroups.com。
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
没有评论:
发表评论