【问题标题】:Cannot Start thin server Ruby Gem无法启动瘦服务器 Ruby Gem
【发布时间】:2013-09-13 04:51:36
【问题描述】:

我正在尝试在我的服务器 Redhat 6.2 上设置 redmine 我打算使用薄红宝石宝石与 Nginx 一起运行。 我在关注http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Nginx_to_run_Redmine 我做了以下事情

gem install thin

thin install

这给了我/etc/rc.d/thin下的初始化脚本YML文件配置如下:

---
chdir: /app/redmine-root/
environment: development
address: 0.0.0.0
port: 5000
timeout: 30
log: log/thin.log
pid: tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 100
require: []
wait: 30
servers: 4 
daemonize: true

现在当我执行/etc/rc.d/thin start 时,它会显示

Starting server on 0.0.0.0:5000 ... 
Starting server on 0.0.0.0:5001 ... 
Starting server on 0.0.0.0:5002 ... 
Starting server on 0.0.0.0:5003 ... 

但是当我在/app/redmine-root/tmp/pids 下看到 pid 时,没有 Pid。

因此,我看不到任何服务正在运行。这是第 1 期

我想问的第二件事是,在上面链接所建议的 Nginx conf 中,上游块如下所示:

upstream thin_cluster {
    server unix:/tmp/thin.0.sock;
    server unix:/tmp/thin.1.sock;
    server unix:/tmp/thin.2.sock;
    server unix:/tmp/thin.3.sock;
}

但是 pid 文件在 /app/redmine-root/tmp/pids 中应该可以吗?

第三,在安装时我将环境标记为production

RAILS_ENV=production rake db:migrate

但每当我做thin config -C /etc/thin/redmine.yml 时,它就会变成开发。

请注意,我也有 RVM。 /app/redmine-root/ 的用户和所有者是apache。 我的 nginx 与 apache 一起运行,我也尝试以 apache 的方式运行。

我没有 Ruby 的背景。非常感谢任何帮助。

编辑

经过建议,我在日志中找到了这个。

/usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/backends/tcp_server.rb:16:in `connect': cannot load such file -- thin/connection (LoadError)
        from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/backends/base.rb:55:in `block in start'
        from /usr/local/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `call'
        from /usr/local/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
        from /usr/local/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
        from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/backends/base.rb:63:in `start'
        from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/server.rb:159:in `start'
        from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/controllers/controller.rb:86:in `start'
        from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/runner.rb:187:in `run_command'
        from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/runner.rb:152:in `run!'
        from /usr/local/lib/ruby/gems/2.0.0/gems/thin-1.5.1/bin/thin:6:in `<top (required)>'
        from /usr/local/bin/thin:23:in `load'
        from /usr/local/bin/thin:23:in `<main>'

是因为,我试图在 UNIX 套接字或其他东西上进行配置吗??

【问题讨论】:

  • Thin 会创建像 thin.[port_number].pid 这样的 pid 文件,你的意思是那些文件不存在
  • @Viren 没错,当我启动瘦服务器时,/app/redmine-root/tmp/pids 中没有这样的文件
  • 检查日志瘦服务器失败,如果有 gem 版本冲突尝试使用bundle 命令bundle exec thin -C /etc/thin/redmine.yml 像这样
  • 终于让它运行起来了。我唯一缺少的是在我的 GemFile 中添加 thin。谢谢维伦

标签: ruby redmine thin


【解决方案1】:

您应该将gem thin 添加到您的 Gemfile 中

PS:例如见https://github.com/macournoyer/thin/issues/115

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-26
    • 1970-01-01
    • 2013-03-07
    • 1970-01-01
    • 2011-03-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多