无效的命令“PassengerAppRoot",可能拼写错误或由未包含在服务器配置中的模块定义

人气:482 发布:2022-10-16 标签: apache virtualhost centos passenger botkit

问题描述

我已按照 在 Linux/Unix 生产服务器上安装Passenger + Apache对于 Node.js 应用程序 + Red Hat 6/CentOS 6(带有 RPM) 并且一切正常,但是当我尝试使用 WHM 在我的 centos 6 服务器上配置我的虚拟主机中的子域来托管我的 botkit 机器人时,我得到了这个错误:

/usr/local/apache/bin/httpd"命令(进程 27088)报告结束时出现错误号 1.第 9 行检测到配置问题文件/usr/local/apache/conf/includes/post_virtualhost_2.conf.tmp:无效的命令PassengerAppRoot",可能拼写错误或由模块未包含在服务器配置中 ---/usr/local/apache/conf/includes/post_virtualhost_2.conf.tmp --- 3ServerAlias subdomain.mydomain.com 4 ServerAdminadminserver@mydomain.com 5 6 7 # 告诉 Apache 和Passenger 你的app的代码目录是 8 DocumentRoot/var/www/MyApp/Code/public 9===>PassengerAppRoot/var/www/MyApp/Code <=== 10 #Error logging 11 ErrorLog logs/subdomain-error_log 12 CustomLoglogs/subdomain-access_log common 13 14 # 告诉乘客你的应用是一个 Node.js 应用程序 15PassengerAppType 节点 ---/usr/local/apache/conf/includes/post_virtualhost_2.conf.tmp ---

这是我的配置:

<VirtualHost *:80>服务器名称 www.subdomain.mydomain.comServerAlias subdomain.mydomain.comServerAdmin adminserver@mydomain.com# 告诉 Apache 和 Passenger 你的应用程序的代码目录在哪里DocumentRoot/var/www/MyApp/code/public乘客AppRoot/var/www/MyApp/code#错误记录ErrorLog 日志/votebot-error_logCustomLog 日志/votebot-access_log 常用# 告诉Passenger你的应用是一个Node.js应用乘客应用类型节点乘客启动文件 bot.js# 放宽 Apache 安全设置<目录/var/www/MyApp/code/public>允许所有人选项 - 多视图# 如果您使用的是 Apache >= 2.4,请取消注释:#要求所有授予</目录></虚拟主机>

我试图删除配置并通过 .htaccess 传递:

PassengerEnabled 开启乘客AppRoot/var/www/MyApp/codeSetEnv NODE_ENV 制作SetEnv NODE_PATH/usr/lib/node_modules乘客应用类型节点乘客启动文件 bot.js

但它仍然无法正常工作.我最近检查并在验证乘客时收到以下消息:

 * 检查此乘客安装是否在 PATH... ✓* 检查是否有其他乘客装置...(!)您目前正在验证 Phusion Passenger 5.1.8,位于:/usr/bin/乘客除了这个乘客装置,以下其他还检测到乘客装置:/usr/local/rvm/gems/ruby-2.4.1/bin/passenger请卸载这些其他乘客安装以避免混乱或冲突.

问题是我不知道卸载/usr/local/rvm/gems/ruby-2.4.1/bin/passenger 的步骤是什么.

解决方案

这个错误意味着Passenger模块没有被加载一个LoadModulepassenger_module/path/to/.../passenger/buildout/apache2/mod_passenger.so 行在您的 apache 配置中,然后再指定乘客配置选项.

如果 sudo/usr/bin/passenger-config validate-install 通过了 apache 配置测试,那么您有多个 apache 配置,当您收到错误时正在加载错误的配置.p>

根据您的错误,conf 位于 /usr/local/apache/conf/,使用 fgrep -RH LoadModule 在配置中查找任何 LoadModule 行/usr/local/apache/conf/ 并添加一行来加载Passenger 模块.

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 .

解决方案

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.

813