Nginx和乘客依赖问题(数字海洋部署)

时间:2015-03-02 20:08:51

标签: ruby-on-rails nginx passenger

我试图遵循本指南

https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-nginx-on-ubuntu-14-04

如果我想在运行此命令后继续学习本教程:

sudo apt-get install nginx-extras passenger

我收到此错误:

Reading package lists... Done
Building dependency tree

Reading state information... Done
passenger is already the newest version.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
nginx-extras : Depends: perlapi-5.18.2 but it is not installable
Depends: libperl5.18 (>= 5.18.2) but it is not installable
Recommends: passenger (< 4.0.60) but 1:4.0.59-1~trusty1 is to be installed
E: Unable to correct problems, you have held broken packages.

我认为我无法安装nginx-extras,有人可以帮我吗?

5 个答案:

答案 0 :(得分:54)

我在Ubuntu 14.10上遇到了同样的问题

sudo nano /etc/apt/sources.list.d/passenger.list

评论出来 deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main

CTRL + X
ÿ
输入

sudo apt-get update

sudo apt-get install nginx nginx-extras

然后,如果确定

sudo nano /etc/apt/sources.list.d/passenger.list

插入
deb https://oss-binaries.phusionpassenger.com/apt/passenger wheezy main

CTRL + X
ÿ
输入

sudo apt-get update

sudo apt-get install passenger

瞧!

答案 1 :(得分:29)

如果您使用的是Ubuntu 16.04,请执行以下操作

# Install our PGP key and add HTTPS support for APT
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates

# Add our APT repository
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

# Install Passenger + Nginx
sudo apt-get install -y nginx-extras passenger

答案 2 :(得分:2)

由于这个问题,我使用了nginx-full代替nginx-extras。我正在运行14.10,因为我想要Postgres 9.4。

我一直有很多奇怪的错误,我不小心按照APT说明的方式继续遵守乘客指示。哎呦。所以我最初关注@ Maciej-adamczewski的回答,但他正在添加Debian 7乘客安装而不是Ubuntu 14.04安装。这搞砸了我。

以下是我为让我排序的所作所为:

sudo apt-mark showhold  # apparently I had nothing in here
sudo apt-get autoclean
sudo apt-get update && sudo apt-get upgrade
# I hoped upgrade would get rid of that error re: nginx-extras
# it didn't at all, so decided to scrap and start over

sudo apt-get purge nginx*  # to get rid of everything nginx
sudo apt-get remove nginx*  # paranoia
sudo apt-get purge passenger
sudo apt-get remove passenger  # paranoia again
sudo apt-get autoremove

sudo apt-get update
sudo apt-get install nginx-full passenger

轰!得到nginx正常运行。

它没有在Digital Ocean上说过,但如果你直接安装RVM而不是ruby,你需要找出你的rvm ruby​​的位置:

rvm use
passenger-config --ruby-command

然后复制粘贴显示passenger_ruby /usr/local/...的nginx信息,并覆盖/etc/nginx/nginx.conf文件中的原始passenger_ruby行。

稍后,当您创建网站时,请务必在服务器块中添加passenger_enabled on;以获取nginx!

这个家伙的疯狂道具:Setting up rails on DO

答案 3 :(得分:2)

当我收到此错误时,这是​​因为我试图安装的乘客版本与ubuntu的版本不匹配。检查你是否在ubuntu 14.04上。

如果不是deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main中的/etc/apt/sources.list.d/passenger.list行需要更改以匹配您的ubuntu版本。

然后运行sudo apt-get update

答案 4 :(得分:0)

也许ubuntu版本错误,请尝试使用此命令:

sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'