存档

文章标签 ‘too many connection resets’

用gem翻墙在线安装rubygem.org的软件

2011年10月6日 没有评论

伟大的gfw折腾了我大半个下午,后来才发现自己在gem的时候被gfw给reset了。错误信息如下

ERROR:  While executing gem … (Gem::RemoteFetcher::FetchError)
too many connection resets (http://production.s3.rubygems.org/latest_specs.4.8.gz)

找国内的源镜像没找到。搜到一个哥们说用nginx做反向代理加速gem的。救星啊。。。

http://huacnlee.com/blog/using-nginx-proxy-to-mirror-rubygem-org

如法炮制之,我用的apache做的反向代理,配置如下

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName rubygems.org
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://rubygems.org/
ProxyPassReverse / http://rubygems.org/
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName production.cf.rubygems.org
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://production.cf.rubygems.org/
ProxyPassReverse / http://production.cf.rubygems.org/
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName production.s3.rubygems.org
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://production.s3.rubygems.org/
ProxyPassReverse / http://production.s3.rubygems.org/
</VirtualHost>

然后hosts里再把这3个域名做到vps的ip去即可。

1.1.2.84 rubygems.org
1.1.2.84 production.cf.rubygems.org
1.1.2.84 production.s3.rubygems.org

 

shallwe说有时还需要https(我是没用上),https的反向代理设置如下

yum install mod_ssl -y

vi /etc/httpd/conf.d/ssl.conf

<VirtualHost *:443>

SSLEngine on
SSLProxyEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
DocumentRoot /var/www/html
ServerName production.s3.rubygems.org
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / https://production.s3.rubygems.org/
ProxyPassReverse / https://production.s3.rubygems.org/
</VirtualHost>

<VirtualHost *:443>

SSLEngine on
SSLProxyEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
DocumentRoot /var/www/html
ServerName production.cf.rubygems.org
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / https://production.cf.rubygems.org/
ProxyPassReverse / https://production.cf.rubygems.org/
</VirtualHost>

<VirtualHost *:443>

SSLEngine on
SSLProxyEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
DocumentRoot /var/www/html
ServerName rubygems.org
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / https://rubygems.org/
ProxyPassReverse / https://rubygems.org/
</VirtualHost>