我已经按照在 Linux/Unix 生产服务器上为 Node.js 应用程序 + Red Hat 6 / CentOS 6 (with RPM) 安装Passenger + Apache 中给出的每个安装步骤进行安装,一切正常,但是当我尝试在虚拟主机中配置我的子域时在使用 WHM 托管我的 botkit 机器人的 centos 6 服务器上,我收到此错误:
“/usr/local/apache/bin/httpd”命令(进程 27088)结束时报告错误号 1。在文件 /usr/local/apache/conf/includes/post_virtualhost_2.conf.tmp 的第 9 行检测到配置问题:无效命令“PassengerAppRoot”,可能拼写错误或由服务器配置中未包含的模块定义 --- /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 ===> PassengerAppRoot /var/www/MyApp/Code <=== 10 #Error logging 11 ErrorLog logs/subdomain-error_log 12 CustomLog logs/subdomain-access_log common 13 14 # 告诉乘客你的app 是一个节点。
这是我的配置:
<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 的步骤是什么。