Getting Rails 3 and Passenger to work on CentOS 5.4 - Apache Error

别等时光非礼了梦想. 提交于 2019-12-23 02:33:18

问题


Using Ruby 1.8.7 on CentOS 5.4. Trying to get Rails 3 app up on Passenger.

I have gone through all the steps but get this error in my Apache log file

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)

Don't know where to start. Permission to Ruby or my App is denied?

Passenger in stand alone mode gives me an error about not being able to load Bundler.

Would really like to get this running under Apache2.


回答1:


Tyndall, It looks like the user which runs apache doesn't have permissions

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

try to su to the user which runs apache, and try running ruby or accessing the folder /usr/lib/ruby

Edit

Try these steps to check if apache has permissions.

  • Log in to the unix server
  • [if you're not root] become root by running sudo su -
  • check which user is running apache bye running ps -ef | grep -i apache (the first column should display the user name)
  • now become apache by running su apache - (if apache is the user name)
  • now run cd /usr and ls (cd checks for execution permission on the folder and ls for read permissions)
  • do the same as the step before for /usr/lib. This is necessary because it might be that apache cannot access one of the folders in the path.
  • once you're in /use/lib check that binary file of ruby is there by running ls -l ruby
  • finally try to run ruby from that folder with ./ruby -v (check that it returns the correct version)

If all of that works, please paste here the apache configuration you have for passenger.

It should be something like

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


来源:https://stackoverflow.com/questions/4946426/getting-rails-3-and-passenger-to-work-on-centos-5-4-apache-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!