Ubuntu在代理问题背后安装Nginx

时间:2012-07-30 10:18:30

标签: ruby-on-rails ubuntu nginx passenger

我想安装带有Phusion Passenger支持的Nginx

我有:

Ubuntu 12.04 LTS  
ruby-1.9.3-p194  
Rails 3.2.7  
I am behind the proxy(http://10.10.16.8:3128) 

test@U205-UBUNTU:~$ printenv | grep htt  
http_proxy=http://10.10.16.8:3128  
https_proxy=https://10.10.16.8:3128  

当我运行 rvmsudo passenger-install-nginx-module 时,我收到超时错误:

  PCRE (required by Nginx) not installed, downloading it...  
    # wget -O /tmp/root-passenger-5079/pcre.tar.gz http://downloads.sourceforge.net/project/pcre/pcre/8.30/pcre-8.30.tar.gz  
    --2012-07-30 13:12:27--  http://downloads.sourceforge.net/project/pcre/pcre/8.30/pcre-8.30.tar.gz  
    Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 216.34.181.59  
    Connecting to downloads.sourceforge.net (downloads.sourceforge.net)|216.34.181.59|:80... failed:
    Connection timed out.  
    Retrying.  

看起来没有通过代理访问。

但是当我尝试单独运行wget -O /tmp/root-passenger-5079/pcre.tar.gz http://downloads.sourceforge.net/project/pcre/pcre/8.30/pcre-8.30.tar.gz时,一切正常。

任何人都可以帮助我吗?

2 个答案:

答案 0 :(得分:1)

我找到了解决方案 问题是sudo削减了env变量 要保持env变量,例如http_proxy,ftp_proxy,你必须在/ etc / sudoers文件中添加这一行:

Defaults env_keep="no_proxy http_proxy https_proxy ftp_proxy XAUTHORIZATION \
XAUTHORITY TZ PS2 PS1 PATH MAIL LS_COLORS KRB5CCNAME HOSTNAME HOME DISPLAY COLORS"

答案 1 :(得分:1)

这对我有用:

sudo vim /etc/wgetrc

并编辑以下行:

https_proxy = http://<proxyaddress>:<port>/
http_proxy = http://<proxyaddress>:<port>/
ftp_proxy = http://<proxyaddress>:<port>/

(用您的设置替换<proxyaddress><port>