新手问题 在 Aliyun ECS 上用 Nginx + Passenger 部署 Rails 应用时安装 Passenger 的问题

rennyallen · 2017年02月15日 · 最后由 ringokun 回复于 2017年02月17日 · 4273 次阅读

第一次部署 Rails 应用,参照资料 1 资料 2 资料 3 资料 4等资料在服务器上装好了 ruby, rvm, 相关依赖等,但在安装 passenger 时,参照此官方文档,安装了秘钥和 HTTP 支持,也添加了 APT 源: sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'

但在执行 sudo apt-get update时遇到以下错误:

Hit:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease
Hit:2 http://mirrors.aliyun.com/ubuntu xenial InRelease
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease [102 kB]
Get:4 http://mirrors.aliyun.com/ubuntu xenial-security InRelease [102 kB]      
Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease [102 kB]
Get:6 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease [102 kB]       
Get:7 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed InRelease [253 kB]
                                     ……
                                     ……
Get:45 http://mirrors.aliyun.com/ubuntu xenial-proposed/universe i386 Packages [31.6 kB]
Get:46 http://mirrors.aliyun.com/ubuntu xenial-proposed/universe Translation-en [12.9 kB]
Ign:47 https://oss-binaries.phusionpassenger.com/apt/passenger xenial InRelease 
Ign:48 https://oss-binaries.phusionpassenger.com/apt/passenger xenial Release   
Ign:49 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main amd64 Packages
Ign:50 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main i386 Packages 
Ign:51 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main all Packages
Ign:52 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en_US
Ign:53 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en
Ign:49 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main amd64 Packages
Ign:50 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main i386 Packages
Ign:51 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main all Packages
Ign:52 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en_US
Ign:53 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en
Ign:49 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main amd64 Packages
Ign:50 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main i386 Packages
Ign:51 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main all Packages
Ign:52 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en_US
Ign:53 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en
Ign:49 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main amd64 Packages
Ign:50 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main i386 Packages
Ign:51 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main all Packages
Ign:52 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en_US
Ign:53 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en
Ign:49 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main amd64 Packages
Ign:50 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main i386 Packages
Ign:51 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main all Packages
Ign:52 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en_US
Ign:53 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en
Err:49 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main amd64 Packages
  Bad header line
Ign:50 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main i386 Packages
Ign:51 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main all Packages
Ign:52 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en_US
Ign:53 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main Translation-en
Fetched 6,467 kB in 2min 3s (52.4 kB/s)
Reading package lists... Done
W: The repository 'https://oss-binaries.phusionpassenger.com/apt/passenger xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch https://oss-binaries.phusionpassenger.com/apt/passenger/dists/xenial/main/binary-amd64/Packages  Bad header line
E: Some index files failed to download. They have been ignored, or old ones used instead.

与 passenger 相关的都是 Ign 或者 Err 了,然后报的Bad header line也不知道是怎么回事,总之到apt-get update这步永远也不能成功执行。

服务器系统是 Ubuntu 16.04 LTS,我在本地物理机上相同系统也试了,没有出现这个问题,passenger 可以成功安装,所以应该不是服务器系统或者 APT 源的问题。有人遇到过这种情况吗,google, stackoverflow 试了各种方法折腾了一天一夜也没解决,准备放弃 改用 Puma 了。BTW,用老的方法passenger-install-nginx-module也不行,downloading Nginx 之后就会卡住不动了。

说说我前段时间碰到的类似问题,希望对你有帮助。当时也是装第三方 apt 源不成功,不过错误类型是 apt-get update 报 403。后来发现是阿里云的主机对 apt 配置了代理,应该是为了让内网机器访问自家的源加速,但影响了第三方源的获取。

代理配置在 /etc/apt/apt.conf 里,把它注释掉再 update 就没问题了,注释用 # 号:

Acquire::http::Proxy "http://mirrors.aliyun.com/";

#1 楼 @darkbaby123 👍 你的方法完美解决了我的问题,真的太感谢你了! 回想起来,之前试了其他的 apt 源也是全部不能用,只有阿里云的能够用,应该就是被限制了,但一直没找到解决方法。

I really appreciate u that ur solution fixed my problem perfectly and it works! It reminds me that I have tried many other apt repositories before, but no one works, except Aliyun. So it should be restricted but i cannot find any solution until saw your reply.

遇到了相同的问题,顺利解决了,十分感谢!! 👍 👍 @darkbaby123 @rennyallen

需要 登录 后方可回复, 如果你还没有账号请 注册新账号