How to tell how Apache might be broken and preventing the ruby passenger module from installing

apache-2.2phusion-passengerruby-on-rails

I'm installing a ruby on rails application to a Ubuntu 14.04 server. As part of it, I need to install the passenger module for Apache. When I go to run the "passenger-install-apache2-module" I receive a message that "Your Apache installation might be broken." It gives some suggested commands, but they don't reveal any useful information. The full output is below.

Ruby, rails, Apache, and RVM are all already installed. I have already tried removing and reinstalling all of them before now, with no success.

Is there anything in particular I need to do to see what exactly might be broken with Apache or passenger? I would like to avoid reinstalling Apache or Ruby again.

Thanks in Advance!

The exact output after the passenger script shows that all dependencies have been met.

Sanity checking Apache installation...
AH00526: Syntax error on line 10 of /etc/apache2/pf.conf:
Invalid command 'RailsEnv', perhaps misspelled or defined by a module not included in     the server configuration
AH00526: Syntax error on line 10 of /etc/apache2/pf.conf:
Invalid command 'RailsEnv', perhaps misspelled or defined by a module not included in  the server configuration
Your Apache installation might be broken

You are about to install Phusion Passenger against the following
Apache installation:

apxs2: /usr/bin/apxs2

However, this Apache installation appears to be broken, so this installer
cannot continue. To find out why this installer thinks the above Apache
installation is broken, run:

export ORIG_PATH="$PATH"
rvmsudo -E /bin/bash
export PATH="$ORIG_PATH"
/home/azureuser/.rvm/gems/ruby-2.1.2/wrappers/ruby /home/azureuser/.rvm/gems/ruby-   2.1.2/gems/passenger-4.0.48/bin/passenger-config --detect-apache2

It is also possible that your system has multiple Apache installations,
and that you are simply compiling Phusion Passenger against the wrong
Apache install. If this is the case, then the above command will also
advise you about what to do.

Edit: Further detail after running the commands listed at the bottom. Is the /usr/bin/apxs correct? Shouldn't it be apxs2 since I'm using apache2?

Running the command it gives only produces the same output as above.

Detecting configuration file location...
AH00526: Syntax error on line 10 of /etc/apache2/pf.conf:
Invalid command 'RailsEnv', perhaps misspelled or defined by a module not included in the server configuration
AH00526: Syntax error on line 10 of /etc/apache2/pf.conf:
Invalid command 'RailsEnv', perhaps misspelled or defined by a module not included in   the server configuration
 --> Cannot detect default config file location!
Cannot find a usable Apache installation using /usr/bin/apxs.

Final autodetection results
Sorry, this program cannot find an Apache installation.

To install Apache, please run the following. It will tell you how to install Apache.

/home/azureuser/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.48/bin/passenger-install-apache2-module

If you are sure that you have Apache installed, please read the documentation:
https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#forcing_location_of_command_line_tools_and_dependencies

Best Answer

Your Apache configuration is broken.

Specifically you have a file /etc/apache2/pf.conf which is trying to use directives provided by Phusion Passenger, which you haven't yet installed!

Move this file somewhere else temporarily, then run the installation. Once the installation is complete, you can move it back if necessary.