Phusion Passenger无法使用Apache

时间:2022-10-04 00:12:07

UPDATE: When entering 'passenger-memory-stats' I'm showing:

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

---Passenger processes---
Processes: 0

How do I troubleshoot this? Why would passenger not be starting even though I added it in httpd.conf and restart apache?

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

I'm having trouble getting Phusion Passenger to Run Ruby on Rails on a server. I've followed all instructions at Phusion web site and installed passenger and modified and created Apache VirtualHost to point to the new directory and verified that all .conf files are being loaded successfully. Also httpd -M passenger_module is loaded. I also successfully ran Passenger Standalone and Rails server webrick on localhost and was able to verify that it works with curl.

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

But when I try to run my domain from the browser, I just get a 404 not found or an empty index file that I create in that folder specified by the DocumentRoot under VirtualHost (so I know it's loading .conf and going into the right directory) but it's not loading Rails Application....Can someone please point out what I'm doing wrong? Here are my settings and config:

但是当我尝试从浏览器运行我的域时,我只得到404找不到的或者我在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 about ruby-command:

有关ruby-command的passenger-config:

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

passenger-config validate-install:

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

2 个解决方案

#1


2  

It looks like you are missing your PassengerAppRoot directive.

看起来您缺少PassengerAppRoot指令。

I am running passenger successfully on my Ubuntu 14.04 machines. I have a few more directives in my /etc/apache2/sites-enabled/app.example.com.conf file. I don't know if there are needed for CentOS but they were needed to get things running on Ubuntu.

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

Also, I am using rbenv instead of rvm and I am deploying via Capistrano as the deployer on the server.

此外,我使用rbenv而不是rvm,我通过Capistrano部署为服务器上的部署者。

Here are the relevant parts of my app.example.com.conf file:

以下是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

#2


2  

Okay so after a couple of weeks of frustration/fascination trying to work this out, I have the solution and I really hope it helps someone out there struggling with this!

好吧,经过几周的挫折/迷恋试图解决这个问题,我有了解决方案,我真的希望它可以帮助那些在这里挣扎的人!

THE PROBLEM: I had both apache and litespeed installed on my server and that was the only culprit! I completely disabled litespeed and switched over to apache (you can easily switch between the two using WHM control panel) and ran the passenger-memory-stats again, and everything started working! Passenger auto magically showed up in the processes and then the app showed up in the memory stats as well when I loaded the app!

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

#1


2  

It looks like you are missing your PassengerAppRoot directive.

看起来您缺少PassengerAppRoot指令。

I am running passenger successfully on my Ubuntu 14.04 machines. I have a few more directives in my /etc/apache2/sites-enabled/app.example.com.conf file. I don't know if there are needed for CentOS but they were needed to get things running on Ubuntu.

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

Also, I am using rbenv instead of rvm and I am deploying via Capistrano as the deployer on the server.

此外,我使用rbenv而不是rvm,我通过Capistrano部署为服务器上的部署者。

Here are the relevant parts of my app.example.com.conf file:

以下是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

#2


2  

Okay so after a couple of weeks of frustration/fascination trying to work this out, I have the solution and I really hope it helps someone out there struggling with this!

好吧,经过几周的挫折/迷恋试图解决这个问题,我有了解决方案,我真的希望它可以帮助那些在这里挣扎的人!

THE PROBLEM: I had both apache and litespeed installed on my server and that was the only culprit! I completely disabled litespeed and switched over to apache (you can easily switch between the two using WHM control panel) and ran the passenger-memory-stats again, and everything started working! Passenger auto magically showed up in the processes and then the app showed up in the memory stats as well when I loaded the app!

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