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 [email protected] 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 [email protected]
# 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 .
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 anyLoadModule
lines in the config withfgrep -RH LoadModule /usr/local/apache/conf/
and add a line to load the Passenger module.