【问题标题】:CentOS *** ERROR: Phusion Passenger doesn't seem to be runningCentOS *** 错误:Phusion Passenger 似乎没有运行
【发布时间】:2016-11-15 13:29:15
【问题描述】:

当我通过 capistrano 将我的 rails 应用程序部署到我的 CentOS 服务器时,我一直收到此错误:

*** 错误:Phusion Passenger 似乎没有运行。如果您确定它正在运行,那么导致此问题的原因可能是一个 的:

  1. 您使用 Apache 自定义了实例注册表目录 PassengerInstanceRegistryDir 选项,Nginx 的 passenger_instance_registry_dir 选项,或 Phusion Passenger Standalone 的 --instance-registry-dir 命令行参数。如果有,请设置 环境变量 PASSENGER_INSTANCE_REGISTRY_DIR 到该目录 并再次运行此命令。
  2. 实例目录已被操作系统后台删除 服务。请使用 Apache 设置不同的实例注册表目录 PassengerInstanceRegistryDir 选项,Nginx 的passenger_instance_registry_dir 选项,或 Phusion Passenger Standalone 的 --instance-registry-dir 命令 行参数。

在我的服务器上,我有 apache 和乘客 5.0.30 首先,我在堆栈上查看其他答案: Link to one of these topics。 不幸的是,没有什么对我没有帮助。我也尝试从 apache conf 设置环境路径和其他设置。 知道为了部署我的 Rails 应用程序我应该改变什么吗? PATH 中第一个乘客状态的完整路径在哪里?它与passenger_root匹配吗? 以下是我的日志:

$ passenger-config validate-install


> What would you like to validate? Use <space> to select. If the menu
> doesn't display correctly, press '!'
> 
>    ⬢  Passenger itself  ‣ ⬢  Apache
> 
> -------------------------------------------------------------------------
> 
> Checking whether there are multiple Apache installations... Only a
> single installation detected. This is good.
> 
> -------------------------------------------------------------------------
> 
>  * 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... ✓
> 
> Everything looks good. :-)




$ rvmsudo passenger-memory-stats

Version: 5.0.30
Date   : 2016-11-15 13:43:44 +0100

---------- Apache processes ----------
PID    PPID   VMSize    Private  Name
--------------------------------------
25188  1      476.6 MB  1.5 MB   /usr/sbin/httpd -DFOREGROUND
25220  25188  270.4 MB  0.5 MB   /usr/sbin/httpd -DFOREGROUND
25246  25188  478.6 MB  0.2 MB   /usr/sbin/httpd -DFOREGROUND
25247  25188  478.6 MB  0.2 MB   /usr/sbin/httpd -DFOREGROUND
25248  25188  478.6 MB  0.2 MB   /usr/sbin/httpd -DFOREGROUND
25249  25188  478.6 MB  0.2 MB   /usr/sbin/httpd -DFOREGROUND
25250  25188  478.6 MB  0.2 MB   /usr/sbin/httpd -DFOREGROUND
### Processes: 7
### Total private dirty RSS: 3.08 MB


-------- Nginx processes --------

### Processes: 0
### Total private dirty RSS: 0.00 MB


----- Passenger processes -----
PID    VMSize    Private  Name
-------------------------------
25222  421.0 MB  0.9 MB   Passenger watchdog
25225  772.6 MB  1.5 MB   Passenger core
25234  431.3 MB  1.0 MB   Passenger ust-router
### Processes: 3
### Total private dirty RSS: 3.39 MB

我的 apache 配置文件:

    <VirtualHost *:80>
    ServerName www.app.com
    ServerAdmin admin

    DocumentRoot "/srv/www/app_name/current/public"

LoadModule passenger_module /home/userr/.rvm/gems/ruby-2.2.5/gems/passenger-5.0.30/buildout/apache2/mod_passenger.so

#<IfModule mod_passenger.c>
#    PassengerRuby /usr/local/rvm/gems/ruby-2.2.5
#    PassengerRoot /usr/local/rvm/gems/ruby-2.2.5/gems/passenger-5.0.30
#    PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.5/wrappers/ruby
#    PassengerInstanceRegistryDir /tmp
#</IfModule>

<IfModule mod_passenger.c>
        PassengerRoot /home/userr/.rvm/gems/ruby-2.2.5/gems/passenger-5.0.30
        PassengerDefaultRuby /home/userr/.rvm/gems/ruby-2.2.5/wrappers/ruby
        PassengerInstanceRegistryDir /tmp
</IfModule>

    Options -Indexes -FollowSymLinks -MultiViews

    LogLevel warn
    ErrorLog logs/www.app.com-error.log
    TransferLog logs/www.app.com-access.log
    CustomLog logs/www.app.cp,.log combined

<Directory /srv/www/app_name/current/public>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from All
   </IfModule>
</Directory>

</VirtualHost>

还有我的环境路径:

   env file:
    SHELL=/bin/bash
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    LOGNAME=root
    USER=root
    USERNAME=root
    HOME=/root
    SUDO_COMMAND=/bin/env PASSENGER_INSTANCE_REGISTRY_DIR=/tmp
    SUDO_USER=userr
    SUDO_UID=1001
    SUDO_GID=100
    PASSENGER_INSTANCE_REGISTRY_DIR=/tmp

我肯定做错了什么。感谢您的每一个建议。

【问题讨论】:

    标签: ruby-on-rails apache passenger centos7


    【解决方案1】:

    问题似乎是systemd private temp feature,你可以为httpd禁用它:

    mkdir /etc/systemd/system/httpd.service.d
    echo "[Service]" >  /etc/systemd/system/httpd.service.d/nopt.conf
    echo "PrivateTmp=false" >> /etc/systemd/system/httpd.service.d/nopt.conf
    systemctl daemon-reload
    systemctl restart httpd
    

    Passenger 5.0 不再使用 /tmp 来获取状态信息,因此即使在私人临时工上也应该开箱即用。

    【讨论】:

      【解决方案2】:

      终于解决了我的问题。 我做了两件事。

      首先,我在我的主目录中创建了新的临时文件夹。然后在 Apache 配置文件中我添加了

      PassengerInstanceRegistryDir /home/userr/instancetemp
      

      然后我将其推送到我的环境路径

      echo 'PASSENGER_INSTANCE_REGISTRY_DIR=/home/userr/instancetemp' >> ~/.bash_profile
      

      我认为这已经足够了,但我还在 capistrano 配置中添加了这条路径

      set :default_env, { 
        "PASSENGER_INSTANCE_REGISTRY_DIR" => "/home/userr/instancetemp"
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-10-26
        • 1970-01-01
        • 2013-07-24
        • 2018-09-19
        • 2022-11-23
        • 2015-01-16
        • 2015-09-22
        • 2021-11-27
        相关资源
        最近更新 更多