大佬教程收集整理的这篇文章主要介绍了ruby-on-rails – Nginx,Rails和Oauth.上游过早关闭连接,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
问题.我有一个简单的oauth身份验证,允许用户通过GitHub注册.在GitHub的授权页面上按“允许”后,用户被重定向到回呼路由.然后他/她获得302坏网关错误.
Nginx日志显示我这个错误(键被替换为“…”)
Ther是我的nginx配置.
upstream unicorn { server unix:/tmp/unicorn.tm.sock fail_timeout=0; } server { listen 80 default deferred; client_max_body_size 4G; server_name _; keepalive_timeout 75s; proxy_connect_timeout 60s; proxy_read_timeout 60s; root /vagrant/PUBLIC; try_files $uri/index.html $uri.html $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://unicorn; proxy_buffer_size 16k; proxy_busy_buffers_size 16k; } error_page 500 502 503 504 /500.html; }
所以我的问题是为什么会发生这种情况,有没有可能的修复?
我一直在搜索一段时间,但没有运气.
更新
感谢您的评论,我刚刚尝试设置fail_timeout = 30s,它有帮助,但是请求大约需要40秒才能完成.但是不管怎么说,我会尝试使用这个参数来过期.
我更新了我的配置,根据建议,但仍然,得到相同的错误.
另外,这是独角兽错误日志.似乎它杀死了需要超过30秒的请求,但我猜从oauth站点重定向不可能那么长
(github) request phase initiated. (github) CallBACk phase initiated. E,[2012-12-26T19:33:13.058183 #6002] ERROR -- : worker=0 PID:6005 timeout (31s > 30s),killing E,[2012-12-26T19:33:13.067011 #6002] ERROR -- : reaped #<Process::Status: pid 6005 SIGKILL (signal 9)> worker=0 I,[2012-12-26T19:33:13.067198 #6002] INFO -- : worker=0 spawning... I,[2012-12-26T19:33:13.068631 #6012] INFO -- : worker=0 spawned pid=6012 I,[2012-12-26T19:33:13.068726 #6012] INFO -- : refreshing Gem list I,[2012-12-26T19:33:17.140948 #6012] INFO -- : worker=0 ready
独角兽配置
rails_env = ENV['RAILS_ENV'] || 'production' worker_processes 1 listen "/tmp/unicorn.tm.sock",:BACklog => 64 listen 8080,:tcp_nopush => true timeout 30 pid "/tmp/unicorn.pid" stderr_path "/tmp/unicorn.log" stdout_path "/tmp/unicorn.log" check_client_connection false
ERROR -- : worker=0 PID:6005 timeout (31s > 30s),killing
至少尝试一下
timeout 60
http://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-timeout
以上是大佬教程为你收集整理的ruby-on-rails – Nginx,Rails和Oauth.上游过早关闭连接全部内容,希望文章能够帮你解决ruby-on-rails – Nginx,Rails和Oauth.上游过早关闭连接所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。