Phusion Passenger 不在 Apache 上工作

Phusion Passenger Not Working on Apache

更新:输入 'passenger-memory-stats' 时显示:

---Passenger processes---
Processes: 0

我该如何解决这个问题?为什么即使我在 httpd.conf 中添加它并重新启动 apache,passenger 也不会启动?

我无法将 Phusion Passenger 连接到服务器 Rails 上的 运行 Ruby。我已经按照 Phusion 网站上的所有说明安装了 passenger 并修改并创建了 Apache VirtualHost 以指向新目录并验证所有 .conf 文件都已成功加载。还加载了 httpd -M passenger_module 。我还在本地主机上成功 运行 Passenger Standalone 和 Rails 服务器 webrick,并且能够验证它是否适用于 curl。

但是当我尝试从浏览器 运行 我的域时,我只是得到一个 404 not found 或我在 VirtualHost 下的 DocumentRoot 指定的文件夹中创建的一个空索引文件(所以我知道它是加载 .conf 并进入正确的目录)但它没有加载 Rails 应用程序....有人可以指出我做错了什么吗?这是我的设置和配置:

ruby -v:
ruby 2.1.2p95

rails -v:
Rails 4.2.3

passenger -v:
Phusion Passenger version 5.0.15

httpd -v:
Apache/2.2.27 (Unix)

opearting system:
CentOS

uname -i: 
x86_64

httpd.conf:

Include "/usr/local/apache/conf/includes/mydomain.conf"
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-5.0.15/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-5.0.15
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.2/wrappers/ruby
</IfModule>

/usr/local/apache/conf/includes/mydomain.conf:

<VirtualHost 208.79.235.241:80>
ServerName mydomain.com
DocumentRoot /home/clevert/public_html/rails_apps/mydomain.com/public
PassengerRuby /usr/local/rvm/gems/ruby-2.1.2/wrappers/ruby
<Directory /home/clevert/public_html/rails_apps/mydomain.com/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>

passenger-config 关于ruby-command:

Command: /usr/local/rvm/gems/ruby-2.1.2/wrappers/ruby

乘客配置验证安装:

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. :-)

您似乎缺少 PassengerAppRoot 指令。

我在 Ubuntu 14.04 机器上成功成为 运行 乘客。我的 /etc/apache2/sites-enabled/app.example.com.conf 文件中还有一些指令。我不知道是否需要 CentOS,但需要它们才能在 Ubuntu.运行 上获得东西 运行。

此外,我正在使用 rbenv 而不是 rvm,并且我正在通过 Capistrano 作为服务器上的 deployer 进行部署。

以下是我的 app.example.com.conf 文件的相关部分:

  DocumentRoot /srv/http/app.example.com/current/public
  <Directory /srv/http/app.example.com/current/public>
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>

  PassengerRuby /home/deployer/.rbenv/shims/ruby
  PassengerAppType rack
  PassengerAppRoot /srv/http/app.example.com/current
  PassengerStartupFile config.ru
  PassengerRestartDir /srv/http/app.example.com/current/tmp
  PassengerDebugLogFile /srv/http/app.example.com/shared/log/passenger.log
  # 0 = warn; 1 to 3, increasing levels of debugging information
  PassengerLogLevel 1

好吧,经过 frustration/fascination 几周的努力,我找到了解决方案,我真的希望它能帮助那些正在努力解决这个问题的人!

问题:我的服务器上同时安装了 apache 和 litespeed,这是唯一的罪魁祸首!我完全禁用了 litespeed 并切换到 apache(您可以使用 WHM 控制面板轻松地在两者之间切换)和再次 运行 passenger-memory-stats,一切都开始工作了! Passenger auto 神奇地出现在进程中,然后当我加载应用程序时,应用程序也出现在内存统计中!