Apache passenger stopped work after upgrade passen

2019-07-18 07:11发布

问题:

After upgrade Apache module Passenger from 5.1.12 to 5.2.0 Apache doesn't start properly and exit with the error

# apache2ctl configtest
Invalid command 'PassengerResolveSymlinksInDocumentRoot', perhaps misspelled or defined by a module not included in the server configuration

After comment string in Apache virtual host

# PassengerResolveSymlinksInDocumentRoot on

Apache starts but Redmine doesn't work showing listing directoty/files insted of main page(another words can't find index file)

OS: Ubuntu 14.04.5 LTS

# dpkg -l | grep passenger
ii  libapache2-mod-passenger           1:5.2.0-1~trusty1                                        
ii  passenger                          1:5.2.0-1~trusty1                                        
ii  passenger-dev                      1:5.2.0-1~trusty1                                        
ii  passenger-doc                      1:5.2.0-1~trusty1

All packets is installed from oss-binaries.phusionpassenger.com

# cat /etc/apt/sources.list.d/passenger.list
deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main

Module passenger is enable

# a2query -m | grep pass
passenger (enabled by site administrator)                                        

I have tried reinstall passenger(delete and install again)

# apt-get remove -y passenger libapache2-mod-passenger
# apt-get install -y libapache2-mod-passenger

However it hasn't helped to resove the issue

# passenger-config validate-install
What would you like to validate?
Use <space> to select.
If the menu doesn't display correctly, press '!'

 ‣ ⬢  Passenger itself
  ⬡  Apache

-------------------------------------------------------------------------
* Checking whether this Passenger install is in PATH... ✓
* Checking whether there are no other Passenger installations... ✓

# passenger-config validate-install
What would you like to validate?
Use <space> to select.
If the menu doesn't display correctly, press '!'

⬢  Passenger itself
 ‣ ⬡  Apache

-------------------------------------------------------------------------
* Checking whether this Passenger install is in PATH... ✓
* Checking whether there are no other Passenger installations... ✓

Passenger status

# passenger-status
Version : 5.2.0
Date    : 2018-02-05 12:23:58 +0100
Instance: homhYxzl (Apache/2.4.7 (Ubuntu) Phusion_Passenger/5.2.0)

----------- General information -----------
Max pool size : 6
App groups    : 0
Processes     : 0
Requests in top-level queue : 0

# passenger-install-apache2-module
The Phusion Passenger Apache module is correctly installed :-)

P.S. I have managed to resolve the issue

PassengerResolveSymlinksInDocumentRoot

This option has been removed in 5.2.0 version according to

https://blog.phusion.nl/2018/01/29/passenger-5-2-0/

So there are 2 ways to fix it

1.Don't use symbol links in DocumentRoot

2.Use parameter PassengerAppRoot in virtual host Apache(if you use symbol link in DocumentRoot)

<VirtualHost *:443>
    ServerName myservername
    DocumentRoot /var/www/redmine
    PassengerAppRoot /opt/redmine/redmine
…
</VirtualHost>

# ls -l /var/www/redmine
lrwxrwxrwx 1 root root 27 Apr 27  2017 /var/www/redmine -> /opt/redmine/redmine/public

回答1:

From 5.2.0 Breaking change overview:

We've removed PassengerResolveSymlinksInDocumentRoot. It was an old compatibility option for Passenger version 2. Switch to PassengerAppRoot if you are setting the application root via a document root containing symlinks.

Use PassengerAppRoot to specify your application's root directory



回答2:

I resolve this problem with downgrade passenger version.

1) Uninstall new version:

apt-get remove -y passenger libapache2-mod-passenger

2) Install specific version:

sudo apt-get install passenger=1:5.1.12-1~trusty1
sudo apt-get install libapache2-mod-passenger=1:5.1.12-1~trusty1
sudo apt-get install passenger-dev=1:5.1.12-1~trusty1

3) Enaple apache module:

sudo a2enmod passenger

4) Restart apache:

sudo service apache2 restart

5) Enjoy