Problem with apache + passenger

Hi guys,

I need to install Redmine on my company’s server and set it to run on
Apache + Passenger.

I’m able to run Redmine using Webrick, but when I try to run it on
Apache+Passenger it doesn’t work. I access the Redmine’s url in the
browser and I see a list of files instead of the Redmine’s main page. It
seems Passenger is not working.

My files are like this:

cat /etc/apache2/mods-enabled/passenger.load
LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so

cat /etc/apache2/mods-enabled/passenger.conf
PassengerDefaultUser www-data

PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.13
PassengerRuby /usr/bin/ruby1.9.1

cat /etc/apache2/sites-available/default
<VirtualHost *:80>
DocumentRoot /var/www/redmine-2.0.3/public
ServerName anyDomain.com/redmine
RailsEnv production

   <Directory />
           Options FollowSymLinks
           AllowOverride None
   </Directory>
   <Directory /var/www/redmine-2.0.3/public >

RailsBaseURI /redmine-2.0.3/public

PassengerResolveSymlinksInDocumentRoot on

           Options -Indexes FollowSymLinks MultiViews
           AllowOverride None
           Order allow,deny
           allow from all
   </Directory>

After configuring these files like that I restarted Apache:
/etc/init.d/apache2 restart

I’m new with Linux and I’m not sure how to check if the module Passenger
is installed in Apache. I found the file
/usr/lib/apache2/modules/mod_passenger.so in the server, so does it
means that the module is installed?

I’ll appreciate any help.

Thanks

On Monday, 16 July 2012 13:06:48 UTC-4, Ruby-Forum.com User wrote:

DocumentRoot /var/www/redmine-2.0.3/public ServerName cpro5331.publiccloud.com.br/redmine

The “/redmine” bit here may be confusing the issue. It’s definitely not
correct, but Apache may ignore the error.

   <Directory />
           Options FollowSymLinks
           AllowOverride None
   </Directory>
   <Directory /var/www/redmine-2.0.3/>

This should point to the same place as DocumentRoot - it’s currently
missing /public.

–Matt J.

On Tue, Jul 17, 2012 at 6:04 AM, Bruno S. [email protected]
wrote:

<VirtualHost *:80>
DocumentRoot /var/www/redmine-2.0.3/public
ServerName cpro5331.publiccloud.com.br/redmine <= WRONG

That should be hostname and (optionally) port. Have you looked at the
Apache httpd documentation?

RailsEnv production
<Directory /var/www/redmine-2.0.3/public >

RailsBaseURI /redmine-2.0.3/public

PassengerResolveSymlinksInDocumentRoot on

Are those lines really commented out?

Even this way it isn’t working. I restarted Apache and it still showing
the list of files instead of Redmine’s main page. Any other suggestion?

Are there any errors in your logs at startup? Can you run apachectl -S
without errors?


Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

Hi,

I put redmine.cpro5331.publiccloud.com.br instead of ServerName
cpro5331.publiccloud.com.br/redmine but now I’m not able to access
redmine.cpro5331.publiccloud.com.br in the browser. The message says
that the server was not found.

Those lines are commented out because I don’t know if I should put them?
Should I take them out or uncomment them?

RailsBaseURI /redmine-2.0.3/public

PassengerResolveSymlinksInDocumentRoot on

Here is the result of the command before I change the file
/etc/apache2/sites-available/default:

apache2ctl -S

[Tue Jul 17 10:59:44 2012] [warn] module dav_svn_module is already
loaded, skipping
[Tue Jul 17 10:59:44 2012] [warn] module authz_svn_module is already
loaded, skipping
VirtualHost configuration:
wildcard NameVirtualHosts and default servers:
*:80 is a NameVirtualHost
default server cpro5331.publiccloud.com.br
(/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost cpro5331.publiccloud.com.br
(/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost cpro5331.publiccloud.com.br/svn
(/etc/apache2/sites-enabled/000-default:39)
port 80 namevhost cpro5331.publiccloud.com.br/redmine
(/etc/apache2/sites-enabled/000-default:49)
Syntax OK

Here is the result after changing it:

apache2ctl -S

[Tue Jul 17 11:10:44 2012] [warn] module dav_svn_module is already
loaded, skipping
[Tue Jul 17 11:10:44 2012] [warn] module authz_svn_module is already
loaded, skipping
VirtualHost configuration:
wildcard NameVirtualHosts and default servers:
*:80 is a NameVirtualHost
default server cpro5331.publiccloud.com.br
(/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost cpro5331.publiccloud.com.br
(/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost cpro5331.publiccloud.com.br/svn
(/etc/apache2/sites-enabled/000-default:39)
port 80 namevhost redmine.cpro5331.publiccloud.com.br
(/etc/apache2/sites-enabled/000-default:49)
Syntax OK

Thanks again.

Good morning Matt,

Thank you for your reply. I’m not sure if I understood very well what
you meant. You said the issue may be caused by the tag Directory that
hasn’t the same place as DocumentRoot, right? For example, here it would
be wrong:

   <Directory />
           Options FollowSymLinks
           AllowOverride None
   </Directory>
   <Directory /var/www/redmine-2.0.3/>

So, I changed the configuration and now it’s like this:

<VirtualHost *:80>
DocumentRoot /var/www/redmine-2.0.3/public
ServerName cpro5331.publiccloud.com.br/redmine
RailsEnv production
<Directory /var/www/redmine-2.0.3/public >

RailsBaseURI /redmine-2.0.3/public

PassengerResolveSymlinksInDocumentRoot on

           Options -Indexes FollowSymLinks MultiViews
           AllowOverride None
           Order allow,deny
           allow from all
   </Directory>

Even this way it isn’t working. I restarted Apache and it still showing
the list of files instead of Redmine’s main page. Any other suggestion?

Thanks again.

In the Apache’s log:

[Tue Jul 17 11:26:56 2012] [notice] caught SIGTERM, shutting down
[Tue Jul 17 11:26:57 2012] [error] *** Passenger could not be
initialized because of this error: Unable to start the Phusion Passenger
watchdog because its executable
(/usr/lib/ruby/gems/1.8/gems/passenger-3.0.13/agents/PassengerWatchdog)
does not exist. This probably means that your Phusion Passenger
installation is broken or incomplete, or that your ‘PassengerRoot’
directive is set to the wrong value. Please reinstall Phusion Passenger
or fix your ‘PassengerRoot’ directive, whichever is applicable.

It seems Passenger was not installed correctly. I tried to install
Passenger using this command:

sudo passenger-install-apache2-module

It didn’t work and appeard this message:

WARNING: Apache doesn’t seem to be compiled with the ‘prefork’, ‘worker’
or ‘event’ MPM
Phusion Passenger has only been tested on Apache with the ‘prefork’, the
‘worker’ and the ‘event’ MPM. Your Apache installation is compiled with
the ‘itk’ MPM. We recommend you to abort this installer and to recompile
Apache with either the ‘prefork’, the ‘worker’ or the ‘event’ MPM.

How to compile Apache with prefork ? Is it hard to do ? May it cause any
problem? I’m afraid of doing this because I have some app running on
Apache.

Thanks.

On Tue, Jul 17, 2012 at 7:36 AM, Bruno S. [email protected]
wrote:

In the Apache’s log:

[Tue Jul 17 11:26:57 2012] [error] *** Passenger could not be
initialized because of this error: Unable to start the Phusion Passenger
watchdog because its executable
(/usr/lib/ruby/gems/1.8/gems/passenger-3.0.13/agents/PassengerWatchdog)
does not exist. This probably means that your Phusion Passenger
installation is broken or incomplete, or that your ‘PassengerRoot’
directive is set to the wrong value. Please reinstall Phusion Passenger
or fix your ‘PassengerRoot’ directive, whichever is applicable.

It seems Passenger was not installed correctly.

You confirmed that the file referenced above doesn’t exist? And that
your PassengerRoot is correct? Because “not installed correctly” is
one of three possibilities there :slight_smile:

How to compile Apache with prefork ? Is it hard to do ? May it cause any
problem? I’m afraid of doing this because I have some app running on
Apache.

And you have an app that’s not running. So download the source
and take a shot at it; test your applications on your dev/staging server
until you’re satisfied.

Or forget using Passenger and take the less intrusive (IMO) approach
of proxying to a cluster of unicorns or whatever. I prefer that because
of the flexibility to test or run with different backend servers,
anyway.

HTH,

Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

I got it working following this steps in order to fix the problems was
happening:

1 - Install Apache with prefork and passenger again:
apt-get -f install
apt-get install apache2-mpm-prefork
sudo gem install passenger
sudo passenger-install-apache2-module

2 - Change the VirtualHost configuration to that:
<VirtualHost *:80>
ServerName cpro5331.publiccloud.com.br
DocumentRoot /var/www/redmine-2.0.3/public
RackBaseURI /
RailsEnv production
<Directory /var/www/redmine-2.0.3/public >
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

Now it’s ok and running =)

Thank you very much guys. Your tips were essencial for me to got it
working. I hope someone may benefit from my solution here.