【问题标题】:Apache+Passenger doesn't work, why?Apache+Passenger 不工作,为什么?
【发布时间】:2011-10-29 20:11:17
【问题描述】:

我尝试在我的 Apache 设置中设置乘客,

我收到此错误:

A source file that the application requires, is missing.

It is possible that you didn't upload your application files correctly. Please check whether all your application files are uploaded.
A required library may not installed. Please install all libraries that this application requires.

Further information about the error may have been written to the application's log file. Please check it in order to analyse the problem.

Error message:
    no such file to load -- config/environment
Exception class:
    LoadError
Application root:
    /home/username/Sites/railsapp/ 
Backtrace:
    #   File   Line   Location
    0   /usr/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb   36   in `require'
    1   /usr/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb   36   in `require'
    2   /etc/httpd/passenger/lib/phusion_passenger/railz/application_spawner.rb   303   in `preload_application'
    3   /etc/httpd/passenger/lib/phusion_passenger/railz/application_spawner.rb   252   in `block in initialize_server'
    4   /etc/httpd/passenger/lib/phusion_passenger/utils.rb   230   in `report_app_init_status'
    5   /etc/httpd/passenger/lib/phusion_passenger/railz/application_spawner.rb   237   in `initialize_server'
    6   /etc/httpd/passenger/lib/phusion_passenger/abstract_server.rb   193   in `start_synchronously'
    7   /etc/httpd/passenger/lib/phusion_passenger/abstract_server.rb   162   in `start'
    8   /etc/httpd/passenger/lib/phusion_passenger/railz/application_spawner.rb   213   in `start'
    9   /etc/httpd/passenger/lib/phusion_passenger/spawn_manager.rb   261   in `block (2 levels) in spawn_rails_application'
    10   /etc/httpd/passenger/lib/phusion_passenger/abstract_server_collection.rb   126   in `lookup_or_add'
    11   /etc/httpd/passenger/lib/phusion_passenger/spawn_manager.rb   255   in `block in spawn_rails_application'
    12   /etc/httpd/passenger/lib/phusion_passenger/abstract_server_collection.rb   80   in `block in synchronize'
    13   < td=""> <>  prelude>   10:in `synchronize'
    14   /etc/httpd/passenger/lib/phusion_passenger/abstract_server_collection.rb   79   in `synchronize'
    15   /etc/httpd/passenger/lib/phusion_passenger/spawn_manager.rb   254   in `spawn_rails_application'
    16   /etc/httpd/passenger/lib/phusion_passenger/spawn_manager.rb   153   in `spawn_application'
    17   /etc/httpd/passenger/lib/phusion_passenger/spawn_manager.rb   286   in `handle_spawn_application'
    18   /etc/httpd/passenger/lib/phusion_passenger/abstract_server.rb   351   in `main_loop'
    19   /etc/httpd/passenger/lib/phusion_passenger/abstract_server.rb   195   in `s  tart_synchronously'
    20   /etc/httpd/passenger/bin/passenger-spawn-server   61   in `'

我的虚拟主机 apache 配置:

<VirtualHost *:80>
   ServerName railsapp
   DocumentRoot "/home/username/Sites/railsapp/public "
   RailsEnv development
   PassengerAppRoot /home/username/Sites/railsapp/ 
   <Directory /home/username/Sites/railsapp/public/>
        Allow from all
        Options -MultiViews
        Order allow,deny
   </Directory>
</VirtualHost>

我找不到为什么会出现此错误。如果我用 WEBRick 运行应用程序,一切正常。

感谢您的帮助。

【问题讨论】:

  • 你看过这个答案吗>stackoverflow.com/questions/2732963/…?听起来很像你遇到的问题
  • 此外,Apache 2.4 的 VHost Directory 部分应该看起来像 ``` AllowOverride None 要求所有授予 ``` 很难判断您是否使用 2.2。或 2.4。我在这里只提到这一点是因为我在使用 apache 2.4 配置Passenger 时遇到了一些问题,这是解决方案的一部分

标签: ruby-on-rails-3 apache2 passenger


【解决方案1】:

/home/username/Sites/railsapp/config/environments 中有一个名为 production.rb 的文件吗?由于Passenger 正在运行RAILS_ENV 生产,这似乎缺失了。

WEBrick 将在该文件夹中使用 development.rb,因为那是正在运行的 RAILS_ENV。

【讨论】:

  • 是的,我的配置/环境中有一个 production.rb,该站点在带有乘客和 apache 的生产主机上工作。但我不想再使用 WEBrick,这就是我想安装 Apache + Passenger 的原因。我在我的虚拟主机配置中也指定了 RailsEnv
【解决方案2】:

您的DocumentRoot 包含一个空格。

"/home/username/Sites/railsapp/public "

我建议不要引用这个字符串。

/home/username/Sites/railsapp/public

【讨论】:

  • 是的,对不起,我的错误,我删除了“”,我也得到了同样的错误
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-10
  • 2021-11-01
  • 2021-10-03
  • 1970-01-01
  • 1970-01-01
  • 2010-10-06
相关资源
最近更新 更多