1

我在 Debian 上有一个squid代理服务。

当连接到使用任何谷歌分析或雅虎的网站时,它不会加载。我想这是因为我的代理设置有问题:

auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/passwd
auth_param basic children 5
auth_param basic realm please login to the squid server?
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off

acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl Safe_ports port 901         # SWAT
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager


http_access allow localnet
http_access allow localhost
http_access allow localhost

http_port 3128 
coredump_dir /var/cache/squid
#refresh patterns for caching static files
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i \.(gif|png|jpg|jpeg|ico)$ 10080 90% 43200 override-expire ignore-no-cache ignore-no-store ignore-private
refresh_pattern -i \.(iso|avi|wav|mp3|mp4|mpeg|swf|flv|x-flv)$ 43200 90% 432000 override-expire ignore-no-cache ignore-no-store ignore-private
refresh_pattern -i \.(deb|rpm|exe|zip|tar|tgz|ram|rar|bin|ppt|doc|tiff)$ 10080 90% 43200 override-expire ignore-no-cache ignore-no-store ignore-private
refresh_pattern -i \.index.(html|htm)$ 0 40% 10080
refresh_pattern -i \.(html|htm|css|js)$ 1440 40% 40320
refresh_pattern . 0 40% 40320

icp_access allow localnet
icp_access deny all
acl ip1 myip xxx.xxx.xxx.xxx
tcp_outgoing_address xxx.xxx.xxx.xxx ip1
cache_mgr JohnPaulHenry@gmail.com
cache_mem 1 GB
visible_hostname onlytestproxy.com
maximum_object_size 100 MB
maximum_object_size_in_memory 128 KB

forwarded_for off
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

shutdown_lifetime 3 seconds

xxx.xxx.xxx.xxx显然意味着我的IP,所以也许我做错了什么。

我尝试添加一些iptables规则,例如:

iptables -t nat -I PREROUTING -p tcp --dport 443 -j ACCEPT

我还尝试了一堆我通过谷歌找到的代码,但没有运气。

如果有人能指出问题所在并说 +- 如何解决它,那就太好了!

4

1 回答 1

1

您必须添加transparentor intercept(3.1+ 版本)才能让 squid 知道它是透明的。

所以:

http_port 3128 

变得:

http_port 3128 transparent # for old versions

或者:

http_port 3128 intercept # 3.1+ vesrsions
于 2014-07-07T14:33:46.817 回答