Squid在创建代理服务器时拒绝所有网站

时间:2015-11-08 04:35:19

标签: http proxy squid http-proxy

因此我尝试为我的抓取工具创建代理服务器,而且我不确定为什么我甚至被自己拒绝了。当我访问浏览器中的任何网站时,在我已安装Squid的计算机上以及所有内容上,它都会给我以下错误消息:

ERROR

The requested URL could not be retrieved

While trying to retrieve the URL: http://www.whatismyipaddress.com/

The following error was encountered:

Access Denied.
Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.

Your cache administrator is webmaster. 
Generated Sun, 08 Nov 2015 04:03:13 GMT by WIN-AIUOBK0JHPA (squid/2.7.STABLE8)

我已在Internet选项中编辑了我的局域网设置,以允许代理服务器使用正确的IP地址(运行ipconfig时为IPv4),为其提供了正确的端口以便打开,并且我已经还在我的Windows防火墙中打开了端口。

以下是我的squid.conf文件的片段:

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 CONNECT method CONNECT

acl localhost src 192.168.1.0/255.255.255.255 
http_access allow localhost

(skip through some commented out segments....)

http_access allow manager localhost

http_access allow localnet

正如您所知,我已经删除了许多不必要的评论部分。低了,我有我的......

http_port ####

...线。

我不知道为什么我会被封锁。我会不断刷新,所以如果您需要更多信息或有任何疑问,请告诉我。非常感谢你!!

2 个答案:

答案 0 :(得分:2)

您的配置应该如下所示

http_access allow localhost 
http_access allow localnet 
# And finally deny all other access to this proxy 
http_access deny all

并从配置中删除以下行

acl localhost src 192.168.1.0/255.255.255.255 
不需要将localhost指定为ACL,仅用于访问localhost页面。您已将localhost与localnet混淆,修改该行,如下所示

acl localnet src 192.168.1.0/255.255.255.255 

您的lan客户端本地IP命中代理应属于上述src范围或根据需要修改范围。来自其他ips的所有其他请求将被拒绝

答案 1 :(得分:0)

我刚刚摆脱了所有默认配置并使用了以下内容:

# cat /etc/squid/squid.conf
http_port 3128
acl vpc_no_internet src 10.130.0.0/255.255.0.0
http_access allow vpc_no_internet
coredump_dir /var/spool/squid
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880
refresh_pattern .               0       20%     4320

注意:上述配置仅允许访问指定的子网。