加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 使用Apache运行Mongrel for Rails

发布时间:2020-12-17 02:02:24 所属栏目:百科 来源:网络整理
导读:我正在尝试部署我的小型rails应用程序.我的VPS正在运行Apache 2.2,我希望将请求直接发送到一个mongrel集群来处理我的新rails应用程序. Ruby版本1.9.3 Rails版本3.2.7 Mongrel版本1.2.0(gem install mongrel –pre) 我做了什么 我已经为端口3001到3003启动了3
我正在尝试部署我的小型rails应用程序.我的VPS正在运行Apache 2.2,我希望将请求直接发送到一个mongrel集群来处理我的新rails应用程序.

Ruby版本1.9.3
Rails版本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

分别.

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

NOTE: Gem::SourceIndex.from_installed_gems is deprecated with no
replacement. It will be removed on or after 2011-10-01.
Gem::SourceIndex.from_installed_gems called from
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:109.
NOTE: from_installed_gems(arg) is deprecated. From
/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’ NOTE: Gem::SourceIndex.from_gems_in is
deprecated with no replacement. It will be removed on or after
2011-10-01. Gem::SourceIndex.from_gems_in called from
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:50.
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will
be removed on or after 2011-11-01. Gem::SourceIndex#each called from
/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没有运行它应该运行,但也许我已经错误地设置了我的虚拟主机.

任何帮助和/或指导表示赞赏,谢谢!

解决方法

检查了Mongrel日志文件,看来问题是我的database.yml文件指定适配器为sqlite3,应该是mysql2.我没有安装sqlite3,因此Mongrel无法启动.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读