Version 10, last updated by Michael Chletsos at May 02, 2011 06:56 UTC
Set up Chat server
1. Compile NGINX
Create a dir to hold the sources while compiling.
Download NGINX from http://nginx.org/download/nginx-0.7.65.tar.gz
Dowload NGINX Push module from http://pushmodule.slact.net/ in this example we will be using v0.692
Extract both archives side by side and
cd nginx-0.765/
./configure --add-module=../nginx_http_push_module-0.692/
Check the output for errors, if everything looks ok do:
sudo make && make install
2. Configure NGINX
Locate nginx.conf, check /usr/local/nginx/conf/
Now update your nginx.conf and add:
location ~* /chat/(.*)/publish_chat_messages$ {
set $push_channel_id $1;
push_publisher;
push_authorized_channels_only on;
push_store_messages on; # enable message queueing
push_message_timeout 1m;
push_min_message_buffer_length 0;
push_max_message_buffer_length 10;
}
# public long-polling endpoint
location ~* /chat/(.*)/activity$ {
set $push_channel_id $1;
push_subscriber;
push_subscriber_concurrency broadcast;
default_type text/plain;
}
# end Push Configurations
At this point your nginx.conf could look like this:
http {
...
upstream localhost {
server 127.0.0.1:8080; #where 8080 is the port of your rails server
}
server {
...
proxy_buffering off;
location / {
proxy_pass http://localhost/;
}
Chat specific from above.
}
}
restart nginx.