【问题标题】:Troubles running Rails on Raspberry Pi在 Raspberry Pi 上运行 Rails 的问题
【发布时间】:2014-02-15 01:02:04
【问题描述】:

我已经尝试了我所知道的一切,并在堆栈和谷歌上上下查找。

我将 raspbian 与 apache2/passenger4.0.37 Ruby 2.1.0 Rails 4.0.2 一起使用。

当我尝试加载我的网站时,我收到 500 错误,当我检查 apache 日志时,我遇到了

/usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- /phusion_passenger/platform_info/operating_system (LoadError)
        from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
        from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
        from /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/lib/phusion_passenger.rb:233:in `require_passenger_lib'
        from /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/lib/phusion_passenger/native_support.rb:68:in `libext'
        from /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/lib/phusion_passenger/native_support.rb:81:in `library_name'
        from /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/lib/phusion_passenger/native_support.rb:214:in `compile_and_load'
        from /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/lib/phusion_passenger/native_support.rb:49:in `start'
        from /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/lib/phusion_passenger/native_support.rb:376:in `<top (required)>'
        from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
        from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
        from /usr/share/phusion-passenger/helper-scripts/passenger-spawn-server:79:in `<main>'
[ pid=8453 thr=3069558784 file=ext/apache2/Hooks.cpp:862 time=2014-02-14 19:47:12.154 ]: Unexpected error in mod_passenger: Cannot spawn application '/var/www/gobles': Could not read from the spawn server: Connection reset by peer (104)
  Backtrace:
     in 'virtual Passenger::SessionPtr Passenger::ApplicationPool::Client::get(const Passenger::PoolOptions&)' (Client.h:742)
     in 'Passenger::SessionPtr Hooks::getSession(const Passenger::PoolOptions&)' (Hooks.cpp:294)
     in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:563)

ruby 应用程序中没有日志文件。

任何帮助将不胜感激。谢谢:D

由于我们正处于权限错误的路径上,所以我想分享一下。

ps aux | grep -i apache

产量

root      9457  0.0  1.7  36584  7984 ?        Ss   11:13   0:00 /usr/sbin/apache2 -k start
www-data  9493  0.0  1.2  36836  5696 ?        S    11:13   0:00 /usr/sbin/apache2 -k start
www-data  9494  0.0  1.0  36616  4528 ?        S    11:13   0:00 /usr/sbin/apache2 -k start
www-data  9495  0.0  1.2  36836  5696 ?        S    11:13   0:00 /usr/sbin/apache2 -k start
www-data  9496  0.0  1.0  36616  4512 ?        S    11:13   0:00 /usr/sbin/apache2 -k start
www-data  9497  0.0  1.0  36616  4512 ?        S    11:13   0:00 /usr/sbin/apache2 -k start
www-data  9499  0.0  1.0  36616  4512 ?        S    11:13   0:00 /usr/sbin/apache2 -k start

对于乘客

root      9460  0.0  0.3   4420  1712 ?        Ssl  11:13   0:00 PassengerWatchdog
root      9467  0.0  0.5  13376  2272 ?        Sl   11:13   0:00 PassengerHelperAgent
nobody    9478  0.0  0.7  11060  3212 ?        Sl   11:13   0:00 PassengerLoggingAgent

看看我的应用

drwxr-xr-x 8 root root 4096 Feb 14 18:30 app
drwxr-xr-x 2 root root 4096 Feb 14 18:30 bin
drwxr-xr-x 5 root root 4096 Feb 14 18:30 config
-rwxr-xr-x 1 root root  154 Feb 14 18:30 config.ru
drwxr-xr-x 2 root root 4096 Feb 14 18:30 db
-rwxr-xr-x 1 root root 1187 Feb 14 18:51 Gemfile
-rwxr-xr-x 1 root root 2844 Feb 14 18:52 Gemfile.lock
-rwxr-xr-x 1 root root 1187 Feb 14 22:59 Gemfile.save
drwxr-xr-x 4 root root 4096 Feb 14 18:30 lib
drwxr-xr-x 2 root root 4096 Feb 14 19:42 log
drwxr-xr-x 2 root root 4096 Feb 14 18:30 public
-rwxr-xr-x 1 root root  251 Feb 14 18:30 Rakefile
-rwxr-xr-x 1 root root  478 Feb 14 18:30 README.rdoc
drwxr-xr-x 8 root root 4096 Feb 14 18:30 test
drwxr-xr-x 3 root root 4096 Feb 14 18:30 tmp
drwxr-xr-x 3 root root 4096 Feb 14 18:30 vendor

我试过 chown www-data:www-data 也没有运气。

【问题讨论】:

标签: ruby-on-rails ruby apache


【解决方案1】:

所以根据Cannot spawn application这个问题看来,问题是乘客用户没有运行rails应用的权限。

看日志就知道了

Cannot spawn application '/var/www/gobles': Could not read from the spawn server: Connection reset by peer (104). 

您可以尝试做的一件事是找出乘客用户名是什么,然后在/var/www/gobles 目录上执行chmod -R

【讨论】:

  • 通读您的链接,并在应用程序目录上尝试 chmod -R 755。仍然得到相同的错误。我也尝试了link,但这似乎不起作用我一直收到“无法将部分上下文应用于未标记的文件”我对此进行了一些搜索,但所有其他建议似乎也不起作用。跨度>
  • 你在找什么。我在linux中不是那么好。以上仍然是我得到的错误。 /var/log/messages 里面什么都没有。和 /var/www/gobles/log 也一样。
猜你喜欢
  • 1970-01-01
  • 2021-04-13
  • 2018-01-08
  • 1970-01-01
  • 2022-01-20
  • 1970-01-01
  • 1970-01-01
  • 2022-12-07
  • 1970-01-01
相关资源
最近更新 更多