0

I have a Facebook game and since i started using nginx in front of node.js process it seems that many websocket connections are dropped. Does someone know if there are some versions of nginx and socket.io that are problematic or if someone has the good combination please let me and others with similar problem know. I am using socket.io 0.9.14 and nginx 1.6.2.

Here is mine nginx config file:

server {
    listen 443;
        server_name maumaugame.com; 
    access_log /var/log/nginx/maumau_access.log;

    ssl on;
    ssl_certificate /etc/ssl/certs/ssl-bundle.crt;
    ssl_certificate_key /etc/ssl/private/maumaugame.key;    

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    ssl_prefer_server_ciphers on;

    location / {
     proxy_pass http://node;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "upgrade";
         proxy_http_version 1.1;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header Host $host;
     proxy_read_timeout 86400s;
    }

# Serve static files without going through upstreams
  location ~ \.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|tar|wav|bmp|rtf|js|mp3)$ {
    root /var/www/maumaugame.com/public_html/public;
    access_log /var/log/nginx/maumau_other_access.log;
    expires 1h;
  }
}

upstream node {
    ip_hash;
       server 127.0.0.1:8000;
}

I don't know if moving to socket.io 1.0+ will solve this problem?

  • Hi Dusan! Have you solved your issue? I am having a lot of trouble with the similar one. I would appretiate any hint. Here more details: http://stackoverflow.com/questions/29043879/socket-io-with-nginx – Aleks Mar 17 '15 at 14:44
  • No, i just changed it so the socket traffic does not go through nginx. Now I only serve static files with nginx – Dusan Radojevic Mar 17 '15 at 18:00

0 Answers0