【问题标题】:Running Mongrel for Rails with Apache使用 Apache 为 Rails 运行 Mongrel
【发布时间】:2012-08-04 13:02:42
【问题描述】:

我正在尝试部署我的小型 Rails 应用程序。我的 VPS 正在运行 Apache 2.2,我希望将请求定向到一个 mongrel 集群来处理我的新 Rails 应用程序。

Ruby 版本 1.9.3 轨道版本 3.2.7 Mongrel 1.2.0 版(gem install mongrel --pre)

我做了什么

我已经为端口 3001 到 3003 启动了 3 个 mongrel 守护进程,其内容如下:

mongrel_rails start -e production -p 3001 -d -P log/mongrel1.pid

分别。

运行每个启动命令后的注意事项;我收到以下通知:

注意:Gem::SourceIndex.from_installed_gems 已弃用,没有 替代品。它将在 2011 年 10 月 1 日或之后删除。 Gem::SourceIndex.from_installed_gems 调用自 /usr/local/rvm/gems/ruby-1.9.3-p194/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:109。 注意: from_installed_gems(arg) 已弃用。从 /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb:63:in `block (2 levels) in deprecate' 注意:Gem::SourceIndex.from_gems_in 是 已弃用,没有替代品。它将在当天或之后删除 2011-10-01。 Gem::SourceIndex.from_gems_in 调用自 /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:50。 注意: Gem::SourceIndex#each 已被弃用,没有替代品。它会 在 2011 年 11 月 1 日或之后删除。 Gem::SourceIndex#each 调用自 /usr/local/rvm/gems/ruby-1.9.3-p194/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:112。

我的理解告诉我这应该不是问题,但是当我运行时:

ps aux | grep mongrel

我明白了:

someotheruser     17186  0.0  0.1 101064  1336 pts/0    S    12:56   0:00 su mongrel
mongrel  17187  0.1  0.3  67260  2872 pts/0    S    12:56   0:00 bash
mongrel  17284  0.0  0.1  65600   980 pts/0    R+   12:56   0:00 ps aux
mongrel  17285  0.0  0.0  61176   728 pts/0    R+   12:56   0:00 grep mongrel

也就是说,我找不到服务器进程。

我已将我的虚拟主机更新为:

<proxy balancer://mongrelcluster>
  BalancerMember http://127.0.0.1:3001
  BalancerMember http://127.0.0.1:3002
  BalancerMember http://127.0.0.1:3003
</proxy>

<VirtualHost *:80>
  ServerName subdomain.mydomain.co.uk
  ServerAlias subdomain.mydomain.co.uk
  ProxyPass / balancer://mongrelcluster/
  ProxyPassReverse / balancer://mongrelcluster/
  ProxyPreserveHost on
</VirtualHost>

当我将浏览器定向到 subdomain.mydomain.co.uk 时,我收到一个 Apache 403 错误,但我不知道错误在哪里。 mongrel 可能没有按应有的方式运行,但也许我的虚拟主机设置不正确。

感谢任何帮助和/或指导,谢谢!

【问题讨论】:

  • 正如您似乎已经猜到的那样:听起来杂种不会​​出现。你检查了log/mongrel.loglog/production.log 文件吗?
  • @iltempo 谢谢,不知道我为什么不先看那里。

标签: ruby-on-rails centos mongrel


【解决方案1】:

检查了 Mongrel 日志文件,问题似乎是我的 database.yml 文件将适配器指定为 sqlite3,而它应该是 mysql2。我没有安装 sqlite3,所以 Mongrel 无法启动。

【讨论】:

    【解决方案2】:

    我认为您的 VirtualHost 标记中可能缺少 DocumentRoot 规范。

    【讨论】:

      猜你喜欢
      • 2010-10-07
      • 2013-09-09
      • 2010-09-07
      • 2012-07-27
      • 1970-01-01
      • 2011-05-30
      • 2013-11-28
      • 2010-11-28
      • 1970-01-01
      相关资源
      最近更新 更多