phusion / passenger_apt_automation

Tools for automatically building a Debian APT repository for Phusion Passenger
MIT License
20 stars 20 forks source link

Passenger + Nginx on ubuntu 18.04 is not working #22

Closed dorijan closed 5 years ago

dorijan commented 6 years ago

Hi, I am trying to install Passenger + Nginx on ubuntu 18.04, and it seems it install successfully, but it does not work, I got error directive "passenger_enabled" in /etc/nginx/sites-enabled/default

Whole debug info is here

KieranP commented 6 years ago

+1 Doesn't appear to be any 18.04 APT repo for Passenger enterprise currently. When I try switch from "xenial" to "bionic" the whole thing breaks, keys don't match, sources don't exist... I just started upgrading our infra from 14.04 to 18.04, and can't progress much further :-(

cc @FooBarWidget @OnixGH

starpeak commented 6 years ago

Is there a solution soon? Else I would have to rework my whole nginx+passenger builder :(

FooBarWidget commented 6 years ago

We are planning to release 5.3.0 along with Ubuntu 18.04 packages on Wednesday.

timkleier commented 6 years ago

I followed the instructions for Passenger + NGINX on Ubuntu 18.04 LTS (with APT) and it failed the first part of step 2 (configuration files not found). The service didn't seem to get installed, as which nginx returns nothing and there's no 'nginx' folder in /usr/sbin. Any ideas?

CamJN commented 6 years ago

nginx is a separate package now, you'll have to apt install -y nginx, it's been a topic of debate whether to add this to the docs.

timkleier commented 6 years ago

Thanks, @CamJN, I'd suggest adding it to the docs because I thought I remembered reading somewhere that they'd be packaged together, but it's obviously the NGINX module rather than NGINX itself.

dorijan commented 6 years ago

So now it is possible to have Passenger nginx module? I thought that nginx do not support modules like Apache?

OnixGH commented 6 years ago

So now it is possible to have Passenger nginx module?

Yes, since Passenger 5.0.28.

KieranP commented 6 years ago

@FooBarWidget @OnixGH I followed the enterprise install guide (https://www.phusionpassenger.com/library/install/nginx/install/enterprise/bionic/), but when I get to step 3, and run the "apt-get update" command, I get the following:

root@host:/var/lib/apt# apt-get update
Hit:1 http://asia-east1.gce.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://asia-east1.gce.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://asia-east1.gce.archive.ubuntu.com/ubuntu bionic-backports InRelease
Ign:4 https://apt.datadoghq.com stable InRelease
Hit:5 https://apt.datadoghq.com stable Release
Hit:7 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:8 http://archive.canonical.com/ubuntu bionic InRelease
Ign:9 https://www.phusionpassenger.com/enterprise_apt bionic InRelease
Hit:10 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
Hit:11 https://nginx.org/packages/mainline/ubuntu bionic InRelease
Get:12 https://www.phusionpassenger.com/enterprise_apt bionic Release [22.7 kB]
Get:13 https://www.phusionpassenger.com/enterprise_apt bionic Release.gpg [819 B]
Ign:13 https://www.phusionpassenger.com/enterprise_apt bionic Release.gpg
Reading package lists... Done
W: GPG error: https://www.phusionpassenger.com/enterprise_apt bionic Release: The following signatures were invalid: 16378A33A6EF16762922526E561F9B9CAC40B2F7
E: The repository 'https://www.phusionpassenger.com/enterprise_apt bionic Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Usage of apt_auth.conf(5) should be preferred over embedding login information directly in the sources.list(5) entry for 'https://www.phusionpassenger.com/enterprise_apt'

No amount of googling for a solution has fixed this.

Any ideas?

OnixGH commented 6 years ago

@KieranP on Enterprise it's best to file a support ticket, so we can make sure you get a timely response and situation updates.

In any case we are aware of this particular issue and working on it!

aivils commented 6 years ago

In my case Ubuntu 18.04 ignores /etc/nginx/modules-enabled/ I added single line in file /etc/nginx/nginx.conf

load_module /usr/lib/nginx/modules/ngx_http_passenger_module.so;
synek317 commented 5 years ago

In my case Ubuntu 18.04 ignores /etc/nginx/modules-enabled/ I added single line in file /etc/nginx/nginx.conf

load_module /usr/lib/nginx/modules/ngx_http_passenger_module.so;

@aivils T H A N K Y O U !!! I can't count how many hours it took me to configure it.

DaniG2k commented 5 years ago

How are you generating ngx_http_passenger_module.so?

I get the following error when trying to load that module:

$ sudo nginx -t
nginx: [emerg] dlopen() "/usr/lib/nginx/modules/ngx_http_passenger_module.so" failed (/usr/lib/nginx/modules/ngx_http_passenger_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/nginx.conf:4
nginx: configuration file /etc/nginx/nginx.conf test failed
synek317 commented 5 years ago

@DaniG2k

install libnginx-mod-http-passenger and do

if [ ! -f /etc/nginx/modules-enabled/50-mod-http-passenger.conf ]; then sudo ln -s /usr/share/nginx/modules-available/mod-http-passenger.load /etc/nginx/modules-enabled/50-mod-http-passenger.conf ; fi
DaniG2k commented 5 years ago

@synek317 thanks!

DaniG2k commented 5 years ago

I am wondering why the Phusion Passenger docs don't mention adding

load_module /usr/lib/nginx/modules/ngx_http_passenger_module.so;

to /etc/nginx/nginx.conf as it doesn't seem to work without that directive... 🤔

CamJN commented 5 years ago

We don't mention adding that line because in our testing nginx on Ubuntu 18.04 does include the config files from the modules-enabled directory. We do specify to make sure that the passenger conf file is located in that dir, using the command @synek317 mentions.

As to why some users see Nginx on Ubuntu 18.04 ignore /etc/nginx/modules-enabled/ that I don't know, as the nginx available from apt clearly includes that dir (line 4 of /etc/nginx/nginx.conf).

DaniG2k commented 5 years ago

@CamJN I upgraded from an old version of Ubuntu (14? 16? can't remember now) which might explain why? You must've tested on a clean 18 install.

CamJN commented 5 years ago

Indeed, if the base nginx config wasn't updated (I believe apt puts the new config files in place with a .dpkg-dist suffix by default) that very well could explain it.

medir commented 5 years ago

After spending some hours I fixit installing nginx-extras packages:

sudo apt-get install -y nginx-extras

invisibleBully commented 5 years ago

In my case Ubuntu 18.04 ignores /etc/nginx/modules-enabled/ I added single line in file /etc/nginx/nginx.conf

load_module /usr/lib/nginx/modules/ngx_http_passenger_module.so;

@aivils T H A N K Y O U !!! I can't count how many hours it took me to configure it.

@DaniG2k

install libnginx-mod-http-passenger and do

if [ ! -f /etc/nginx/modules-enabled/50-mod-http-passenger.conf ]; then sudo ln -s /usr/share/nginx/modules-available/mod-http-passenger.load /etc/nginx/modules-enabled/50-mod-http-passenger.conf ; fi

@synek317 This actually works!

MoroccoIT commented 5 years ago

Hey folks, I ran into exact same issue with Nginx after I upgraded Ubuntu from 16.04 to 18.04. Since I am not updating production server directly (that would be a suicide), I am testing on image backup instead. After I had this issue I terminated to temp instance that I upgraded to ubuntu 18 with Ngnix problem, and wanted to get a clean upgrade instead. Now I am back to my original instance ubuntu 16.04. But since I see few potential solutions here, I was wondering if there is anything I can do on Nginx level before I can even start ubuntu upgrade in hopes to prevent the Nginx problem and I don’t need to change things around after ubuntu upgrade is done. Basically, I am looking for a clean ubuntu upgrade including Nginx. Thank you.

CamJN commented 5 years ago

@MoroccoIT your issue is that we changed approaches to our nginx package when ubuntu started shipping a version of nginx compatible with dynamic modules; that requires that the module be loaded. Ubuntu provides a working config with their nginx package but apt can't safely overwrite your existing nginx config when you upgrade, so that is going to be a manual step.

More broadly, when you upgrade a package you should always look at any config changes that were included but not applied, and apply them yourself if necessary. You can read about how to change apt's behaviour here: https://askubuntu.com/a/104912

gr8bit commented 5 years ago

For the record, I had to apt-get install libnginx-mod-http-passenger-enterprise in order to upgrade my passenger to enterprise and get rid of this error: nginx: [emerg] open() "/etc/nginx/modules-enabled/50-mod-http-passenger.conf" failed (2: No such file or directory) in /etc/nginx/nginx.conf:7

alilland commented 4 years ago

@gr8bit i'm experiencing the same issues, but I am not an enterprise user, did you make the update because you are an enterprise user?

maxleonca commented 3 years ago

Same here but with Ubuntu 20.04, every check seems to be OK but when I restart nginx y get

[emerg] unknown directive "passenger_root" in ...

cassiompf commented 3 years ago

@DaniG2k

install libnginx-mod-http-passenger and do

if [ ! -f /etc/nginx/modules-enabled/50-mod-http-passenger.conf ]; then sudo ln -s /usr/share/nginx/modules-available/mod-http-passenger.load /etc/nginx/modules-enabled/50-mod-http-passenger.conf ; fi

Thanks, this solution helped me solve this problem.

Prajapatisantu commented 1 year ago

Same here but with Ubuntu 20.04, every check seems to be OK but when I restart nginx y get

[emerg] unknown directive "passenger_root" in ...

how do you fixed this error?