我已按照Installing Passenger + Apache on a Linux/Unix production server for Node.js apps + Red Hat 6 / CentOS 6 (with RPM)中的每个步骤进行安装,但一切正常但当我尝试在我的centos 6服务器上使用WHM托管我的botkit bot的虚拟主机中配置我的子域时,我收到此错误:< / p>
报告了“/ usr / local / apache / bin / httpd”命令(进程27088) 结束时错误编号1。在第9行检测到配置问题 文件/usr/local/apache/conf/includes/post_virtualhost_2.conf.tmp: 无效的命令&#39; PassengerAppRoot&#39;,可能拼写错误或由a定义 模块不包含在服务器配置中--- /usr/local/apache/conf/includes/post_virtualhost_2.conf.tmp --- 3 ServerAlias subdomain.mydomain.com 4 ServerAdmin adminserver@mydomain.com 5 6 7#告诉Apache和Passenger你的位置 应用程序的代码目录是8 DocumentRoot / var / www / MyApp / Code / public 9 ===&GT; PassengerAppRoot / var / www / MyApp / Code&lt; === 10 #Error logging 11 ErrorLog logs / subdomain-error_log 12 CustomLog logs / subdomain-access_log common 13 14#告诉乘客你的应用程序 是一个Node.js app 15 PassengerAppType节点--- /usr/local/apache/conf/includes/post_virtualhost_2.conf.tmp ---
这是我的配置:
<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>
我尝试删除配置并通过.htaccess传递:
PassengerEnabled on
PassengerAppRoot /var/www/MyApp/code
SetEnv NODE_ENV production
SetEnv NODE_PATH /usr/lib/node_modules
PassengerAppType node
PassengerStartupFile bot.js
但它仍然没有用。 我最近检查过并在验证乘客时得到以下信息:
* 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.
问题是我不知道卸载/usr/local/rvm/gems/ruby-2.4.1/bin/passenger的步骤是什么。
答案 0 :(得分:1)
该错误意味着在指定Passenger配置选项之前,Passenger模块尚未在apache配置中加载LoadModule passenger_module /path/to/.../passenger/buildout/apache2/mod_passenger.so
行。
如果sudo /usr/bin/passenger-config validate-install
通过了apache配置测试,那么你有多个apache配置,当你收到错误时会加载错误的配置。
从您的错误中,conf位于/usr/local/apache/conf/
,在配置中查找LoadModule
行fgrep -RH LoadModule /usr/local/apache/conf/
并添加一行以加载Passenger模块。