我已将我的 apache 设置为代理服务器,配置如下:
[server]# cat /etc/apache2/httpd.conf
Listen 10.2.28.56:8787
ProxyRequests on
<Proxy *>
Order deny,allow
Deny from all
Allow from 10.2.0.0/16
</Proxy>
并且 10.2.1.85 的客户端使用 yum 通过此代理更新/安装系统包:
[client]# grep proxy /etc/yum.conf
proxy='http://10.2.28.56:8787'
我也有适合代理使用的环境变量,如下所示:
[client]# cat .bashrc
mytunnel='http://102.28.56:8787'
export http_proxy=$mytunnel
export ftp_proxy=$mytunnel
export HTTP_PROXY=$http_proxy
export FTP_PROXY=$ftp_proxy
当 yum 尝试更新其存储库时,它会抱怨某些 FTP 链接的连接超时,如下所示
[client]# yum -v repolist
Loading "fastestmirror" plugin
Loading "protectbase" plugin
Config time: 0.067
Yum Version: 3.2.22
Loading mirror speeds from cached hostfile
* base: ftp.oss.eznetsols.org
* centosplus: ftp.oss.eznetsols.org
* extras: ftp.oss.eznetsols.org
* rpmforge: apt.sw.be
* updates: ftp.oss.eznetsols.org
ftp://ftp.oss.eznetsols.org/linux/centos/5.7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout: <urlopen error timed out>
Trying other mirror.
我可以按如下方式curl
或wget
投诉 URL(我有正确的 *_proxy 环境变量):
[client]# wget ftp://ftp.oss.eznetsols.org/linux/centos/5.7/os/x86_64/repodata/repomd.xml
--2011-11-30 03:28:33-- ftp://ftp.oss.eznetsols.org/linux/centos/5.7/os/x86_64/repodata/repomd.xml
Connecting to 10.2.28.56:8787... connected.
Proxy request sent, awaiting response... 200 OK
Length: 1140 (1.1K) [application/xml]
Saving to: `repomd.xml'
我猜测来自 yum 的 FTP 连接没有被我的 Apache 代理服务器正确转发,因为我可以通过查看 apache2 错误日志看到它试图连接到错误的端口:
[server]# tail -n1 /var/log/apache2/error.log
[Wed Nov 30 15:50:39 2011] [error] (110)Connection timed out: proxy: FTP: attempt to connect to 111.90.255.253:8787 (*) failed
[server]# host 111.90.255.253
253.255.90.111.in-addr.arpa domain name pointer ftp.oss.eznetsols.org.
这[server]#
是一个 debian(ubuntu 11.04 桌面),而是[client]#
一个 CentOS-5.7(是的,我知道你在笑)
我在这里遗漏了什么?