I am installing a #diaspora #pod in Ubuntu 10.04 LTS,
and configuring it to run behind an #nginx (reverse) proxy,
as suggested in
https://github.com/diaspora/diaspora/wiki/Installing-and-Running-Diaspora
Everything works fine, except for some problems with websockets.
While not really essential for diaspora functionality,
#websockets are doing nice things for the web interface,
like updating pages without reload -
e.g. websockets are placing the little “checked” mark when you are adding a person to one of your aspects.
As long as i connect direct to the app server,
by going to http://my.server.name:3000
everything is fine -
but through the proxy, the websockets would “hang” -
the little rotating circle would circle for minutes before bringing up the check mark.
The reason for this:
A default install of nginx from Ubuntu repository comes with the following settings in /etc/nginx/nginx.conf:
#keepalive_timeout 0; keepalive_timeout 65; tcp_nodelay on;
It is the keepalive_timeout that makes the socket wait -
Slicehost support explains this setting like this
*”The default is very high and can easily be reduced to a few seconds (an initial setting of 2 or 3 is a good place to start and you will rarely need more than that). If no new requests are received during this time the connection is killed.
OK, but what does it mean? Well, once a connection has been established and the client has requested a file, this says “sit there and ignore everyone else until the time limit is reached or you get a new request from the client.
Why would you want a higher time? In cases where there will be a lot of interactivity on the site. However, in most cases, people will go to a page, read it for a while and then click for the next page. You don’t want the connection sat there doing nothing and ignoring other users.”*
source: http://articles.slicehost.com/2008/5/15/ubuntu-hardy-nginx-configuration
So, changing this value to something low or disabling altogether, by doing
keepalive_timeout 0;
will solve this little problem.













