NodeJS server on DigitalOcean using socket.io returns connection refused

后端 未结 2 1679
无人共我
无人共我 2021-01-07 01:34

I was trying to introduce socket.io to my application developed in Laravel and in AngularJS.
The application works fine in my computer, nevertheless when I try to make i

2条回答
  •  余生分开走
    2021-01-07 02:28

    Socket.io use /socket.io after your domaine name. Then you have to specify the socket.io location :

    location ~* \.io {
        proxy_pass http://localhost:8080;
        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;        
    }
    

    And don't forget the upstream for your node js app

    upstream app_yourdomain {
        server 127.0.0.1:3000;
        keepalive 8;
    }
    

提交回复
热议问题