1

I have followed every step for installation given in Installing Passenger + Apache on a Linux/Unix production server for Node.js apps + Red Hat 6 / CentOS 6 (with RPM) and everything worked but when I am trying to configure my subdomain in virtualhost on my centos 6 server using WHM to host my botkit bot, I get this error :

The “/usr/local/apache/bin/httpd” command (process 27088) reported error number 1 when it ended. Configuration problem detected on line 9 of file /usr/local/apache/conf/includes/post_virtualhost_2.conf.tmp: Invalid command 'PassengerAppRoot', perhaps misspelled or defined by a module not included in the server configuration --- /usr/local/apache/conf/includes/post_virtualhost_2.conf.tmp --- 3 ServerAlias subdomain.mydomain.com 4 ServerAdmin adminserver@mydomain.com 5 6 7 # Tell Apache and Passenger where your app's code directory is 8 DocumentRoot /var/www/MyApp/Code/public 9 ===> PassengerAppRoot /var/www/MyApp/Code <=== 10 #Error logging 11 ErrorLog logs/subdomain-error_log 12 CustomLog logs/subdomain-access_log common 13 14 # Tell Passenger that your app is a Node.js app 15 PassengerAppType node --- /usr/local/apache/conf/includes/post_virtualhost_2.conf.tmp ---

Here is my configuration:

<VirtualHost *:80>
    ServerName www.subdomain.mydomain.com
    ServerAlias subdomain.mydomain.com
    ServerAdmin adminserver@mydomain.com


    # Tell Apache and Passenger where your app's code directory is
    DocumentRoot /var/www/MyApp/code/public
    PassengerAppRoot /var/www/MyApp/code
    #Error logging
     ErrorLog logs/votebot-error_log
     CustomLog logs/votebot-access_log common

    # Tell Passenger that your app is a Node.js app
    PassengerAppType node
    PassengerStartupFile bot.js

    # Relax Apache security settings
    <Directory /var/www/MyApp/code/public>
      Allow from all
      Options -MultiViews
      # Uncomment this if you're on Apache >= 2.4:
      #Require all granted
    </Directory>
</VirtualHost>

I tried to remove the configuration and pass via .htaccess :

PassengerEnabled on
PassengerAppRoot /var/www/MyApp/code
SetEnv NODE_ENV production
SetEnv NODE_PATH /usr/lib/node_modules
PassengerAppType node
PassengerStartupFile bot.js

But still it is not working. I checked lately and got the following message when validating passenger :

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

   You are currently validating against Phusion Passenger 5.1.8, located in:

     /usr/bin/passenger

   Besides this Passenger installation, the following other
   Passenger installations have also been detected:

     /usr/local/rvm/gems/ruby-2.4.1/bin/passenger

   Please uninstall these other Passenger installations to avoid
   confusion or conflicts.

The problem is I don't know what are the steps to uninstall /usr/local/rvm/gems/ruby-2.4.1/bin/passenger .

aidonsnous
  • 1,475
  • 4
  • 19
  • 41

1 Answers1

1

That error means that the Passenger module hasn't been loaded with a LoadModule passenger_module /path/to/.../passenger/buildout/apache2/mod_passenger.so line in your apache config before the Passenger config options are specified.

If sudo /usr/bin/passenger-config validate-install passed the apache config test, then you have multiple apache configs and the wrong one is being loaded when you get the error.

From your error the conf is at /usr/local/apache/conf/, look for any LoadModule lines in the config with fgrep -RH LoadModule /usr/local/apache/conf/ and add a line to load the Passenger module.

Camden Narzt
  • 2,271
  • 1
  • 23
  • 42
  • I think the problem is as you stated secondly but how I am going to know which config is the wrong one ? And should delete it ? – aidonsnous Sep 06 '17 at 14:11
  • hey @Camden Narzt ; the configuration file is generated automatically; I even tried to use .htacess, and I think enabling the module in .htaccess is the same as doing it in the configuration file but still it doesn't work. – aidonsnous Sep 16 '17 at 14:37
  • What process is generating the config? – Camden Narzt Sep 18 '17 at 13:27
  • @aidonsnous you'll have to elaborate on how WHM works and what kinds of config customization it supports. I'm not at all familiar with that software. – Camden Narzt Sep 19 '17 at 15:15
  • WHM is a web interface for administrating vps server in my case the vps server is running centos 6. Whenever a website application account is created, the application configuration is added(generated) automatically in the apache configuration file. – aidonsnous Sep 20 '17 at 17:16
  • Does WHM allow for customizing the generated config in any way? If so how? – Camden Narzt Sep 21 '17 at 13:41
  • It doesn't but you can add your configuration. – aidonsnous Sep 22 '17 at 22:10
  • 1
    If there's no way to add a `LoadModule` line at the top level, then Passenger cannot be used with an Apache configured this way. I'm sorry. – Camden Narzt Sep 25 '17 at 13:48
  • I've found a way of loading but what name should I put and which location should I give to load passenger? – aidonsnous Sep 26 '17 at 19:23
  • You can get the values you need from the output of `passenger-install-apache2-module` – Camden Narzt Sep 26 '17 at 19:53
  • Can loading it start passenger process because when I run sudo /usr/sbin/passenger-memory-stats it showing that there is no process running.... and the command passenger-install-apache2-module gives error : /usr/local/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'passenger' (>= 0) among 66 total gem(s) (Gem::LoadError) from /usr/local/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec' from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem' from /usr/local/bin/passenger-install-apache2-module:22:in `
    '
    – aidonsnous Sep 26 '17 at 20:00
  • You should run `gem uninstall passenger` to remove the passenger gem since you have installed the rpm package. After that try passenger-install-apache2-module again. – Camden Narzt Sep 26 '17 at 20:03
  • ERROR: While executing gem ... (Gem::InstallError) cannot uninstall, check `gem list -d passenger` This happen after running gem uninstall passenger – aidonsnous Sep 26 '17 at 20:05
  • 1
    Does `/usr/local/rvm/gems/ruby-2.4.1/bin/passenger` still exist? You may need to try and track down any remaining vestiges of the gem that rvm may still have around. For example rvm makes stubs of commands that gems install. – Camden Narzt Sep 26 '17 at 20:15
  • /usr/local/rvm/gems/ruby-2.4.1/bin/passenger doesn't exist. How can I You track down any remaining vestiges of the gem that rvm may still have around? how can I remove it so that I reinstall passenger from scratch again? – aidonsnous Sep 30 '17 at 05:25
  • @CamdenNartz I have executed sudo yum remove -y passenger and gem uninstall passenger to uninstall passenger but when I check usr/local/bin passenger files are still around : passenger , passenger-config, passenger-install-apache2-module, passenger-install-nginx-module, passenger-memory-stats, passenger-status Should I delete them manually? the problem is when I try to install after the commands of uninstallation, the computer is saying : Package mod_passenger-5.1.8-1.el6.x86_64 already installed and latest version Nothing to do . So I am suspecting these files to be the cause. – aidonsnous Oct 01 '17 at 04:56