让Rails 3和Passenger在CentOS 5.4上工作 - Apache错误

时间:2011-02-09 14:48:03

标签: ruby-on-rails ruby apache passenger

在CentOS 5.4上使用Ruby 1.8.7。试图在乘客上获得Rails 3应用程序。

我已完成所有步骤,但在我的Apache日志文件中出现此错误

Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220):
Could not start the spawn server: /usr/lib/ruby/: Permission denied (13)
[ pid=18207 thr=3086812880 file=ext/apache2/HelperAgent.cpp:354 time=2011-02-09 09:27:18.541 ]: Could not start the spawn server: write() failed: Broken pipe (32)
     in 'Passenger::SpawnManager::SpawnManager(const std::string&, const boost::shared_ptr<Passenger::ServerInstanceDir::Generation>&, const Passenger::AccountsDatabasePtr&, const std::string&, const Passenger::AnalyticsLoggerPtr&, int, const std::string&)' (SpawnManager.h:540)
     in 'Passenger::ApplicationPool::Pool::Pool(const std::string&, const boost::shared_ptr<Passenger::ServerInstanceDir::Generation>&, const Passenger::AccountsDatabasePtr&, const std::string&, const Passenger::AnalyticsLoggerPtr&, int, const std::string&)' (Pool.h:1078)
     in 'Server::Server(Passenger::FileDescriptor, pid_t, const std::string&, bool, const std::string&, const std::string&, const std::string&, const std::string&, unsigned int, unsigned int, unsigned int, unsigned int, const Passenger::VariantMap&)' (HelperAgent.cpp:241)
     in 'int main(int, char**)' (HelperAgent.cpp:344)

[Wed Feb 09 09:27:18 2011] [error]
Passenger could not be initialized because of this error: Unable to start the Phusion Passenger watchdog because it encountered the following error during startup: Unable to start the Phusion Passenger helper agent: it seems to have crashed during startup for an unknown reason, with exit code 1
[Wed Feb 09 09:27:18 2011] [notice] Digest: generating secret for digest authentication ...
[Wed Feb 09 09:27:18 2011] [notice] Digest: done
Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220):
Could not start the spawn server: /usr/lib/ruby/: Permission denied (13)
[ pid=18221 thr=3086513872 file=ext/apache2/HelperAgent.cpp:354 time=2011-02-09 09:27:18.592 ]: Could not start the spawn server: write() failed: Broken pipe (32)
     in 'Passenger::SpawnManager::SpawnManager(const std::string&, const boost::shared_ptr<Passenger::ServerInstanceDir::Generation>&, const Passenger::AccountsDatabasePtr&, const std::string&, const Passenger::AnalyticsLoggerPtr&, int, const std::string&)' (SpawnManager.h:540)
     in 'Passenger::ApplicationPool::Pool::Pool(const std::string&, const boost::shared_ptr<Passenger::ServerInstanceDir::Generation>&, const Passenger::AccountsDatabasePtr&, const std::string&, const Passenger::AnalyticsLoggerPtr&, int, const std::string&)' (Pool.h:1078)
     in 'Server::Server(Passenger::FileDescriptor, pid_t, const std::string&, bool, const std::string&, const std::string&, const std::string&, const std::string&, unsigned int, unsigned int, unsigned int, unsigned int, const Passenger::VariantMap&)' (HelperAgent.cpp:241)
     in 'int main(int, char**)' (HelperAgent.cpp:344)

不知道从哪里开始。 Ruby或我的应用程序的权限被拒绝了吗?

独立模式的乘客给我一个关于无法加载Bundler的错误。

真的想让它在Apache2下运行。

1 个答案:

答案 0 :(得分:4)

廷德尔 看起来运行apache的用户没有权限

Could not start the spawn server: /usr/lib/ruby/: Permission denied (13)

尝试 su 给运行apache的用户,并尝试运行ruby或访问文件夹/ usr / lib / ruby​​

修改

尝试以下步骤检查apache是​​否具有权限。

  • 登录unix服务器
  • [如果你不是root]通过运行 sudo su -
  • 成为root用户
  • 检查哪个用户正在运行运行 ps -ef |的apache再见grep -i apache (第一列应显示用户名)
  • 现在通过运行 su apache - (如果apache是​​用户名)变为apache
  • 现在运行 cd / usr ls cd 检查文件夹的执行权限, ls 阅读权限)
  • / usr / lib 的步骤相同。这是必要的,因为它可能是apache无法访问路径中的一个文件夹。
  • 一旦你进入 / use / lib ,运行 ls -l ruby​​
  • 检查ruby的二进制文件是否存在
  • 最后尝试使用 ./ ruby​​ -v 从该文件夹运行ruby(检查它是否返回正确的版本)

如果所有这些都有效,请在此粘贴您为乘客提供的apache配置。

应该是

LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.2
PassengerRuby /usr/local/ruby/bin/ruby
PassengerDefaultUser www-data