我尝试将简单的网络聊天部署到服务器(nginx / puma)。但是我收到了浏览器的错误控制台:
WebSocket connection to 'ws://domain.com/cable' failed: Error during WebSocket handshake: Unexpected response code: 404
我的配置服务器domain.conf:
upstream backend {
server unix:///var/run/backend.sock;
}
server {
listen 80 ;
server_name domain.com;
root /home/rails/backend/public;
access_log /home/rails/backend/log/nginx.access.log;
error_log /home/rails/backend/log/nginx.error.log info;
try_files $uri/index.html $uri @backend;
location @backend {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://backend;
}
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location /cable {
proxy_pass http://gifty;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
某些地方出错了吗? AnyOne之前设置它。请帮我搞清楚