ruby-on-rails – 瘦启动错误(`start_unix_server’:没有unix-domain acceptor(RuntimeError))

我使用capistrano(rails 4,ruby 2.1.2,thin 1.6.2,capistrano 2.1.5)将一个rails应用程序部署到nginx,瘦.我通过瘦启动命令开始瘦身.并在此文件thin.log上查看一些错误.谁能告诉我如何解决这个问题?

非常感谢你!

thin.yml

 pid: /home/deploy/myapp/pids/thin.pid
 port: 3000
 timeout: 30
 wait: 30
 log: log/thin.log
 max_conns: 1024
 require: []
 environment: production
 max_persistent_conns: 512
 threaded: true
 no-epoll: true
 daemonize: true
 socket: /home/deploy/myapp/sockets/thin.sock
 chdir: /home/deploy/myapp/current
 address: 0.0.0.0

在/ etc / nginx的/网站-availabel /默认

upstream myapp{
        server 127.0.0.1:3000;
        server 127.0.0.1:3001;
        server 127.0.0.1:3002;
}
server {
        listen   80;
        server_name _;
        character utf-8;


        access_log /home/deploy/myapp/log/access.log;
        error_log /home/deploy/myapp/log/error.log;
        root     /home/deploy/myapp/current/public;

        location / {
                proxy_pass http://127.0.0.1:3000;
        }

}

thin.log

Writing PID to /home/deploy/myapp/pids/thin.pid
Using rack adapter
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on /home/deploy/myapp/sockets/thin.sock, CTRL+C to stop
Exiting!
/home/deploy/.rvm/gems/ruby-2.1.2/gems/eventmachine-1.0.3/lib/eventmachine.rb:528:in `start_unix_server': no unix-domain acceptor (RuntimeError)
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/eventmachine-1.0.3/lib/eventmachine.rb:528:in `start_server'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/eventmachine-1.0.3/lib/eventmachine.rb:548:in `start_unix_domain_server'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/thin-1.6.2/lib/thin/backends/unix_server.rb:19:in `connect'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/thin-1.6.2/lib/thin/backends/base.rb:63:in `block in start'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `call'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/thin-1.6.2/lib/thin/backends/base.rb:73:in `start'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/thin-1.6.2/lib/thin/server.rb:162:in `start'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/thin-1.6.2/lib/thin/controllers/controller.rb:87:in `start'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/thin-1.6.2/lib/thin/runner.rb:199:in `run_command'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/thin-1.6.2/lib/thin/runner.rb:155:in `run!'
    from /home/deploy/.rvm/gems/ruby-2.1.2/gems/thin-1.6.2/bin/thin:6:in `<top (required)>'
    from /home/deploy/.rvm/gems/ruby-2.1.2/bin/thin:23:in `load'
    from /home/deploy/.rvm/gems/ruby-2.1.2/bin/thin:23:in `<main>'
    from /home/deploy/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
    from /home/deploy/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
最佳答案
这是我的nginx使用thin的样子.也许它可以帮助.

   upstream thin_server {
          server 0.0.0.0:8080 fail_timeout=0;
        }

        server {
                listen   80 default;
                root /home/example/public;
                server_name example.com www.example.com;
                index index.htm index.html;


                location / {
                        try_files $uri/index.html $uri.html $uri @app;
                }

                location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mp3|flv|mpeg|avi)${
                                try_files $uri @app;
                        }

                 location @app {
                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                        proxy_set_header Host $http_host;
                        proxy_redirect off;
                        proxy_pass http://thin_server;
            }

            error_page 500 502 503 504 /500.html;
            client_max_body_size 4G;
            keepalive_timeout 10;
}

转载注明原文:ruby-on-rails – 瘦启动错误(`start_unix_server’:没有unix-domain acceptor(RuntimeError)) - 代码日志