【问题标题】:Loading passenger_module in Apache在 Apache 中加载乘客模块
【发布时间】:2016-06-06 21:10:10
【问题描述】:

我在将 passenger_module 加载到 Apache 时遇到问题。

# /usr/local/apache/conf.d/passenger.conf

LoadModule passenger_module  modules/mod_passenger.so

<IfModule mod_passenger.c>
   PassengerRoot /usr/lib/ruby/1.8/phusion_passenger/locations.ini
   PassengerRuby /usr/bin/ruby
   PassengerInstanceRegistryDir /var/run/passenger-instreg
</IfModule>

由于我找不到相对于上述配置文件的modules/mod_passenger.so,我指定了我在其他地方找到的mod_passenger 文件,它位于/usr/lib64/httpd/modules/mod_passenger.so。所以新的配置是:

LoadModule passenger_module  /usr/lib64/httpd/modules/mod_passenger.so

<IfModule mod_passenger.c>
   PassengerRoot /usr/lib/ruby/1.8/phusion_passenger/locations.ini
   PassengerRuby /usr/bin/ruby
   PassengerInstanceRegistryDir /var/run/passenger-instreg
</IfModule>

运行 service httpd restart 给我这个错误:

httpd: Syntax error on line 28 of /usr/local/apache/conf/httpd.conf: Syntax error on line 1 of /usr/local/apache/conf/includes/pre_main_global.conf: 
Syntax error on line 3 of /usr/local/apache/conf.d/passenger.conf: Cannot load /usr/lib64/httpd/modules/mod_passenger.so into server: /usr/lib64/httpd/modules/mod_passenger.so: undefined symbol: ap_escape_html

它实际上是在 apache 配置的顶部加载的。

顺便说一句,如果我这样做:

/usr/bin/passenger-config validate-install

我会得到:

You are about to validate Passenger against the following
Apache installation:

  Apache 2.4.16
  apxs2     : /usr/bin/apxs
  Executable: /usr/local/apache/bin/httpd

However, 1 other Apache installation(s) have been found on your system:

  Apache 2.4.16
  apxs2     : /usr/local/apache/bin/apxs
  Executable: /usr/local/apache/bin/httpd

如果我选择了y,我会得到:

 * Checking whether this Passenger install is in PATH... ✓
 * Checking whether there are no other Passenger installations... ✓
 * Checking whether Apache is installed... ✓
 * Checking whether the Passenger module is correctly configured in Apache... ✓

如果你们能就这个问题分享一些信息,那就太好了。如果需要,请随时询问更多信息。提前致谢。

我正在使用centos-release-6-8.el6.centos.12.3.x86_64

【问题讨论】:

    标签: apache ruby-on-rails-3 passenger


    【解决方案1】:

    我正在运行 Centos 7、Apache 2.4 和 Passenger 5.0.28,它们都安装了 yum。我将乘客作为 apache 模块运行。

    你有 Centos 6,看起来你的 apache 是自定义安装,但是我认为检查我的配置文件可能会有所帮助。

    我服务器上的乘客配置分为:

    # /etc/httpd/conf.modules.d/10-passenger.conf
    
    ### Begin automatically installed Phusion Passenger load snippet ###
    
    LoadModule passenger_module modules/mod_passenger.so
    
    ### End automatically installed Phusion Passenger load snippet ###
    

    # /etc/httpd/conf.d/passenger.conf
    
    ### Begin automatically installed Phusion Passenger config snippet ###
    
    <IfModule mod_passenger.c>
       PassengerRoot /usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini
       PassengerRuby /usr/bin/ruby
       PassengerInstanceRegistryDir /var/run/passenger-instreg
    </IfModule>
    
    ### End automatically installed Phusion Passenger config snippet ###
    

    我可以看到模块本身,似乎位于/etc/httpd/modules/mod_passenger.so/usr/lib64/httpd/modules/mod_passenger.so 中。 所有 apache 模块都显示在两个目录中,并且所有文件看起来都一样。

    1. 您是否安装了运行passenger-install-apache2-module 的乘客?
    2. apache 日志中是否还有其他消息(通常为/var/log/httpd/error_log)?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-31
      • 1970-01-01
      • 2012-05-21
      • 2023-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多