0
socket.io出現問題。當我啓動我的Nodejs應用程序套接字工作正常,但幾分鐘後,連接到websocket被關閉,重新連接後Socket.io火災再次發射。
我正在使用NGINX Proxy,我注意到繞過NGINX問題解決了,我需要編輯哪個配置?我認爲這個問題是我的nginx配置。幾分鐘後Socket.io丟失連接,但只啓用了NGINX代理
這是我NGINX默認配置:
server {
listen 80; #listen for all the HTTP requests
server_name example.com www.example.com;
return 301 https://www.example.com$request_uri; }
server {
server_name example.com;
listen 443 ssl http2;
#Optimize Webserver work
#client_max_body_size 16M;
keepalive_timeout 20;
ssl on;
ssl_certificate /root/social/ssl/cert.pem;
ssl_certificate_key /root/social/ssl/key.pem;
location/{
proxy_pass http://localhost:5430;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
upstream io_nodes {
server 127.0.0.1:5430;
keepalive 20;
}
請幫