我的Nginx服务器在VPS上运行不正常 我正确地完成了所有设置,根据rails cast VPS部署
我仍然收到错误504网关超时错误
Nginx日志
request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "roomies.co.in"
2014/07/26 11:33:58 [error] 6935#0: *10 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 223.239.147.104, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "roomies.co.in"
2014/07/26 11:45:56 [error] 6935#0: *20 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 223.239.147.104, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "roomies.co.in"
2014/07/26 11:48:46 [error] 6935#0: *24 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 223.239.147.104, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "roomies.co.in"
2014/07/26 11:50:03 [error] 6935#0: *24 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 223.239.147.104, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "roomies.co.in"
2014/07/26 11:51:06 [error] 6935#0: *24 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 223.239.147.104, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "roomies.co.in"
以上Nginx日志
以下是Unicorn Log
/home/rails/releases/20140726114415/config/boot.rb:4:in `<top (required)>'
/usr/loc
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn.rb:48:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn.rb:48:in `block in builder'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:750:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:750:in `build_app!'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:623:in `init_worker_process'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:643:in `worker_loop'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:527:in `spawn_missing_workers'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:538:in `maintain_worker_count'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:303:in `join'
/usr/local/rvm/gems/ruby-2`enter code here`.0.0-p353/gems/unicorn-4.7.0/bin/unicorn:126:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn:23:in `load'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn:23:in `<main>'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
E, [2014-07-26T11:59:07.161500 #24415] ERROR -- : reaped #<Process::Status: pid 29887 exit 1> worker=0
I, [2014-07-26T11:59:07.161888 #24415] INFO -- : worker=0 spawning...
E, [2014-07-26T11:59:07.162737 #24415] ERROR -- : reaped #<Process::Status: pid 29885 exit 1> worker=1
I, [2014-07-26T11:59:07.163084 #24415] INFO -- : worker=1 spawning...
I, [2014-07-26T11:59:07.164414 #29891] INFO -- : worker=0 spawned pid=29891
I, [2014-07-26T11:59:07.167923 #29893] INFO -- : worker=1 spawned pid=29893
I, [2014-07-26T11:59:07.186676 #29891] INFO -- : Refreshing Gem list
I, [2014-07-26T11:59:07.188107 #29893] INFO -- : Refreshing Gem list
Unicorn.rb文件
listen "127.0.0.1:8080"
worker_processes 2
user "rails"
worker_processes 2
timeout 30
working_directory "/home/rails/current"
pid "/home/unicorn/pids/unicorn.pid"
stderr_path "/home/unicorn/log/unicorn.log"
stdout_path "/home/unicorn/log/unicorn.log"
如果有人熟悉这类问题,请帮忙
Error I am getting after running bundle exec unicorn_rails
E, [2014-07-26T13:27:52.445453 #16467] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2014-07-26T13:27:52.451129 #16467] ERROR -- : retrying in 0.5 seconds (4 tries left)
E, [2014-07-26T13:27:52.951675 #16467] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2014-07-26T13:27:52.951799 #16467] ERROR -- : retrying in 0.5 seconds (3 tries left)
E, [2014-07-26T13:27:53.452214 #16467] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2014-07-26T13:27:53.452339 #16467] ERROR -- : retrying in 0.5 seconds (2 tries left)
E, [2014-07-26T13:27:53.952728 #16467] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2014-07-26T13:27:53.952846 #16467] ERROR -- : retrying in 0.5 seconds (1 tries left)
E, [2014-07-26T13:27:54.453490 #16467] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2014-07-26T13:27:54.453733 #16467] ERROR -- : retrying in 0.5 seconds (0 tries left)
E, [2014-07-26T13:27:54.954208 #16467] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
/usr/local/rvm/gems/ruby-1.9.3-p484/gems/unicorn-4.8.3/lib/unicorn/socket_helper.rb:185:in `bind': Address already in use - bind(2) (Errno::EADDRINUSE)
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/unicorn-4.8.3/lib/unicorn/socket_helper.rb:185:in `new_tcp_server'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/unicorn-4.8.3/lib/unicorn/socket_helper.rb:165:in `bind_listen'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:242:in `listen'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:809:in `block in bind_new_listeners!'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:809:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:809:in `bind_new_listeners!'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:138:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/unicorn-4.8.3/bin/unicorn_rails:209:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p484/bin/unicorn_rails:23:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p484/bin/unicorn_rails:23:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p484/bin/r
答案 0 :(得分:1)
好像您的Unicorn工作人员正被系统或Monit等外部监控工具杀死。
我的想法是:
1 - 产生2名独角兽工作人员的VPS资源(内存)很低。
2 - 或者由于资源消耗,监控工具会杀死你的独角兽进程。
你可以检查这些类似的问题。
Unicorn error: "ERROR -- : reaped #<Process::Status: pid 12345 SIGABRT (signal 6)> worker=2"
ERROR -- : reaped #<Process::Status: pid 4335 exit 1> worker=0