Squid无法在Amazon EC2上运行

时间:2014-12-21 13:59:35

标签: amazon-ec2 squid

我正在尝试在Amazon EC2(新加坡)上设置代理服务器。但我总是得到" 302暂时移动"尝试运行时出错" Squidclient http://www.google.com"在EC2实例上。我无法通过本地桌面访问任何具有该代理的站点。我刚认识鱿鱼。愿任何人帮我找出问题所在吗?

我的EC2实例是t2.micro Ubuntu Server 14.04 LTS。我创建了一个测试安全组,其中所有流量都在/从任何地方启用入站/出站。鱿鱼版本是3.3.8。

squid.conf实际上是默认值,但注释掉所有拒绝行并允许所有http_access。

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
#http_access deny !Safe_ports
#http_access deny CONNECT !SSL_ports
#http_access allow localhost manager
#http_access deny manager
#http_access allow localhost
http_access allow all
http_port 3128
cache_dir ufs /var/spool/squid3 100 16 256
coredump_dir /var/spool/squid3
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

来自" Squidclient http://www.google.com"的错误是:

HTTP/1.1 302 Moved Temporarily
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Location: http://www.google.com.sg/?gfe_rd=cr&ei=AM2WVORc0YagA8zFgoAI
Content-Length: 260
Date: Sun, 21 Dec 2014 13:37:04 GMT
Server: GFE/2.0
Alternate-Protocol: 80:quic,p=0.02
X-Cache: MISS from ip-172-31-15-144
X-Cache-Lookup: MISS from ip-172-31-15-144:3128
Via: 1.1 ip-172-31-15-144 (squid/3.3.8)
Connection: close

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com.sg/?gfe_rd=cr&amp;ei=AM2WVORc0YagA8zFgoAI">here</A>.
</BODY></HTML>

1 个答案:

答案 0 :(得分:0)

Squidclient运行结果对我来说很合理。您的ec2实例位于新加坡,谷歌正在将您重定向到www.google.com.sg

注意Squidclient的输出

<A HREF="http://www.google.com.sg

您无法通过本地桌面上的squid代理与任何网站联系的原因是您必须在squid的配置中明确允许您的桌面公共IP,如下所示

acl home_network src <your desktop public IP>
http_access allow home_network

然后重启squid

最后,尝试配置squid以侦听更高的端口号而不是3128,更多详细信息位于How can I using squid from internet