Ruby on rails ActionCable-5.2.2使用JRUBY 9.2.0在nginx和puma中不工作时出现断管错误
该项目在nginx和passenger上运行良好,但在puma和nginx上不起作用。 以下是puma错误(到目前为止没有nginx错误): 以下是到目前为止的配置: nginx/sites\u enabled/sitetest.comRuby on rails ActionCable-5.2.2使用JRUBY 9.2.0在nginx和puma中不工作时出现断管错误,ruby-on-rails,nginx,puma,actioncable,ruby-on-rails-5.2,Ruby On Rails,Nginx,Puma,Actioncable,Ruby On Rails 5.2,该项目在nginx和passenger上运行良好,但在puma和nginx上不起作用。 以下是puma错误(到目前为止没有nginx错误): 以下是到目前为止的配置: nginx/sites\u enabled/sitetest.com upstream puma { server unix:///tmp/my_app-puma.sock; } server { listen 80; server_name sitetest.com; location ^~ /
upstream puma {
server unix:///tmp/my_app-puma.sock;
}
server {
listen 80;
server_name sitetest.com;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @puma;
location @puma {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://puma;
}
location /cable {
proxy_pass http://puma;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
error_page 500 502 503 504 /500.html;
client_max_body_size 10M;
keepalive_timeout 10;
}
Production.rb
config.action_cable.url = 'wss://sitetest.com/cable'
config.action_cable.allowed_request_origins = [ 'https://sitetest.com' ]
Rails控制台日志:
Started GET "/cable/" [WebSocket] for 103.10.28.154 at 2019-01-27 18:10:10 +0000
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
WebSocket error occurred: Broken pipe -
它应该与
该链接建议将nio4r gem更新至2.2或更高版本,但actioncable 5.2.2使用nio4r 2.0。
Started GET "/cable/" [WebSocket] for 103.10.28.154 at 2019-01-27 18:10:10 +0000
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
WebSocket error occurred: Broken pipe -