乘客引发错误:`initialize':没有这样的文件或目录

时间:2013-09-22 14:52:26

标签: nginx passenger raspberry-pi redmine raspbian

我正试图和乘客一起运行redmine。我跑了以下的命令:

sudo passenger start RAILS_ENV=production

并获得以下异常:

Stopping web server.../var/lib/gems/1.9.1/gems/daemon_controller-1.1.5/lib/daemon_controller/lock_file.rb:63:in `initialize': No such file or directory - /usr/share/nginx/www/redmine-install/RAILS_ENV=production/passenger.3000.pid.lock (Errno::ENOENT)
    from /var/lib/gems/1.9.1/gems/daemon_controller-1.1.5/lib/daemon_controller/lock_file.rb:63:in `open'
    from /var/lib/gems/1.9.1/gems/daemon_controller-1.1.5/lib/daemon_controller/lock_file.rb:63:in `exclusive_lock'
    from /var/lib/gems/1.9.1/gems/daemon_controller-1.1.5/lib/daemon_controller.rb:289:in `stop'
    from /var/lib/gems/1.9.1/gems/passenger-4.0.18/lib/phusion_passenger/standalone/start_command.rb:637:in `block in stop_nginx'
    from <internal:prelude>:10:in `synchronize'
    from /var/lib/gems/1.9.1/gems/passenger-4.0.18/lib/phusion_passenger/standalone/start_command.rb:634:in `stop_nginx'
    from /var/lib/gems/1.9.1/gems/passenger-4.0.18/lib/phusion_passenger/standalone/start_command.rb:104:in `rescue in run'
    from /var/lib/gems/1.9.1/gems/passenger-4.0.18/lib/phusion_passenger/standalone/start_command.rb:114:in `run'
    from /var/lib/gems/1.9.1/gems/passenger-4.0.18/lib/phusion_passenger/standalone/main.rb:92:in `run_command'
    from /var/lib/gems/1.9.1/gems/passenger-4.0.18/lib/phusion_passenger/standalone/main.rb:62:in `run!'
    from /var/lib/gems/1.9.1/gems/passenger-4.0.18/lib/phusion_passenger/standalone/main.rb:39:in `run!'
    from /var/lib/gems/1.9.1/gems/passenger-4.0.18/bin/passenger:36:in `<top (required)>'
    from /usr/local/bin/passenger:23:in `load'
    from /usr/local/bin/passenger:23:in `<main>'

我用以下方式安装了nginx的乘客(在带有raspbian的覆盆子pi上):

Recompile nginx with passenger support as the standard ubuntu version doesn't have it.

sudo gem install passenger --no-ri --no-rdoc
sudo passenger-install-nginx-module
sudo passenger

Choose /usr/local/nginx as installation directory.

Change the following line in /etc/init.d/nginx:
#DAEMON=/usr/sbin/nginx
DAEMON=/usr/local/nginx/sbin/nginx

In /etc/nginx/nginx.conf add the following to the http section:

passenger_root /var/lib/gems/1.9.1/gems/passenger-4.0.18;
passenger_ruby /usr/bin/ruby1.9.1;

我不确定如何修复此错误。一些帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

你错误地调用了passenger start。正如您在passenger start --help中看到的,它接受一个可选参数[directory],它指向应用程序目录。您基本上是在告诉它应用程序目录位于RAILS_ENV=production,这显然不是一个有效的目录。

设置RAILS_ENV的正确方法是通过--environment选项。请参阅--help