Perl

dklab_realplexor

apt-get install git gcc chkconfig

git clone https://github.com/DmitryKoterov/dklab_realplexor.git

perl -MCPAN -e "install EV"

mv ./dklab_realplexor /op

cd /opt/dklab_realplexor/

ln -s ./dklab_realplexor.conf /etc/dklab_realplexor.conf

ln -s ./dklab_realplexor.init /etc/init.d/dklab_realplexor

config

##
## Default configuration file. Do not modify it!
##
## This file is always loaded on startup, but you may redefine
## parameters in other file if you specify path to this file
## in command-line arguments of dklab_realplexor.pl.
##
## E.g. if you run:
## # ./dklab_realplexor.pl /etc/my_config.conf
## the following config files will be parsed:
## 1. ./dklab_realplexor.conf
## 3. /etc/my_config.conf
##
## Use this behaviour to override default settings.
##
%CONFIG = (
# After starting and opening ports, switch to this user and his group.
SU_USER => "nobody",
# WAIT line (change requires restart).
WAIT_TIMEOUT => 120,
WAIT_MAXLEN => 1024 * 5,
WAIT_ADDR => [
'127.0.0.1:8088',
# If you need to handle more than 65536 parallel client
# connections, specify multiple IP addresses here
# instead of 0.0.0.0 (or multiple ports).
],
# IN line (change requires restart).
IN_TIMEOUT => 20,
IN_MAXLEN => 1024 * 200,
IN_ADDR => [
'127.0.0.1:10010'
],
# Memcached online notification servers.
ID_BINDINGS_SERVERS => [
'127.0.0.1:11311'
],
# Hostname of the current server.
ID_BINDINGS_SERVER_NAME => "default",
# How much events (e.g. online/offline changes) to hold in each
# of 3 event chains accessible via WATCH cmd.
EVENT_CHAIN_LEN => 1000,
# Hook: called before sending a data block to a client. If it returns
# false, data will not be sent. Prototype:
# sub (
# id => $, # ID of this data block
# cursor => $, # cursor of this block
# rdata => \$, # data of the block
# limit_ids => \% # limit this block visibility to these listeners (IDs are in keys)
# listen_cursor => $, # at which cursor client listens now
# listen_pairs => \@ # at which [ [ cursor, ID ], ... ] client listens else
# )
HOOK_CHECK_VISIBILITY => undef,
# How much time to treat the client online after disconnection.
OFFLINE_TIMEOUT => 30,
# Maximum queue length for each ID.
MAX_DATA_FOR_ID => 30,
# An ID queue is cleared after this number of seconds if
# no data is arrived.
CLEAN_ID_AFTER => 3600,
# Charset used in Content-Type for JSON and other responses.
CHARSET => "utf-8",
# Which users are allowed to access the engine.
USERS_FILE => "dklab_realplexor.htpasswd",
# Content of IFRAME which is returned on identifier=IFRAME request.
IFRAME_FILE => "dklab_realplexor.html",
# IFRAME ID.
IFRAME_ID => "IFRAME",
# Content of SCRIPT on identifier=SCRIPT request.
SCRIPT_FILE => "dklab_realplexor.js",
# IFRAME ID.
SCRIPT_ID => "SCRIPT",
# Name of "identifier" marker.
IDENTIFIER => "identifier",
# JS: max bounces.
JS_MAX_BOUNCES => 10,
# JS: reconnect delay.
JS_WAIT_RECONNECT_DELAY => 0.01,
# JS: what URI is used to access realplexor.
JS_WAIT_URI => '/rpl',
# Is debug mode enabled for JS?
JS_DEBUG => 0,
# Debug output verbosity (decrease to speedup):
# 0: totally silent, fastest mode
# 1: show messages only, without timestamps
# 2: show messages only, with timestamps
# 3: show messages, timestamps and storage statistics
VERBOSITY => 3,
# If a realplexor daemon consumes more memory than specified here,
# it is cruelly restarted. Specify 0 to disable restarting.
MAX_MEM_MB => 0,
);
return 1;

Server

server {
listen 80;
server_name rpl.server-name.domen www.server-name.domen;
root /var/www/nginx-sites/crm-m.ztc/crm-m/httpdocs;
access_log /var/log/nginx/server-name.domen.access.log;
error_log /var/log/nginx/server-name.domen.error.log error;
# Необходимо для работы realplexor-а
# Проксирует все запросы на 127.0.0.1:8088
location / {
proxy_pass http://127.0.0.1:8088;
break;
}
}