在 CentOS 5.4 上使用 Ruby 1.8.7。尝试在 Passenger 上安装 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 或我的应用程序的权限被拒绝?
单机模式下的 Passenger 提示我无法加载 Bundler。
真的很想让它在 Apache2 下运行。
最佳答案
丁达尔, 看起来运行 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
- 检查哪个用户正在运行 apache bye running ps -ef | 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
关于ruby-on-rails - 让 Rails 3 和 Passenger 在 CentOS 5.4 上工作 - Apache 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4946426/