oll*_*lpu 11 nginx puma ruby-on-rails-5
我正在尝试使用Capistrano将Action Cable -enabled-application部署到VPS.我正在使用Puma,Nginx和Redis(用于Cable).经过几次跨栏后,我能够在当地的开发环境中工作.我正在使用默认的进程内/有线URL.但是,当我尝试将其部署到VPS时,我不断在JS-log中得到这两个错误:
Establishing connection to host ws://{server-ip}/cable failed.
Connection to host ws://{server-ip}/cable was interrupted while loading the page.
Run Code Online (Sandbox Code Playgroud)
在我的应用程序特定中,nginx.error.log
我收到这些消息:
2016/03/10 16:40:34 [info] 14473#0: *22 client 90.27.197.34 closed keepalive connection
Run Code Online (Sandbox Code Playgroud)
ActionCable.startDebugging()
在JS提示中打开显示没有任何兴趣.只是ConnectionMonitor尝试无限期地重新打开连接.我也得到了301的负载:永久移动 - 在我的网络监视器中请求/ cable.
async
适配器而不是Redis.(这是开发环境中使用的)添加这样的东西到我的/etc/nginx/sites-enabled/{app-name}
:
location /cable/ {
proxy_pass http://puma;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
Run Code Online (Sandbox Code Playgroud)设置Rails.application.config.action_cable.allowed_request_origins
为正确的主机(尝试"http:// {server-ip}"和"ws:// {server-ip}")
Rails.application.config.action_cable.disable_request_forgery_protection
没运气.是什么导致了这个问题?
$ rails -v
Rails 5.0.0.beta3
Run Code Online (Sandbox Code Playgroud)
请告知我可能有用的任何其他详细信息.