要在 Debian 上面安裝,標準官方的 nginx 加上 https://github.com/wandenberg/nginx-push-stream-module 模組

做個筆記,這裡的 nginx 並不是 Debian 官方的 deb,是由 nginx 官方釋出的 deb

裝 官方 nginx ,加個 sources.list 先


# nginx
# wget http://nginx.org/keys/nginx_signing.key
# sudo apt-key add nginx_signing.key
#
deb http://nginx.org/packages/debian/ wheezy nginx
deb-src http://nginx.org/packages/debian/ wheezy nginx



#裝 build depend package

apt-get build-dep nginx

#下載 source
apt-get source nginx

#git clone nginx module ,照官方文件設定環境

git clone https://github.com/wandenberg/nginx-push-stream-module
NGINX_PUSH_STREAM_MODULE_PATH=$PWD/nginx-push-stream-module

# 這時候資料夾,應該有 nginx-1.4.2 的資料夾,看現在新的套件版本

cd nginx-1.4.2

# 編輯一下 vim debian/rules


override_dh_auto_build:
dh_auto_build
mv objs/nginx objs/nginx.debug
./configure <br />–prefix=/etc/nginx <br />–sbin-path=/usr/sbin/nginx <br />–conf-path=/etc/nginx/nginx.conf <br />–error-log-path=/var/log/nginx/error.log <br />–http-log-path=/var/log/nginx/access.log <br />–pid-path=/var/run/nginx.pid <br />–lock-path=/var/run/nginx.lock <br />–http-client-body-temp-path=/var/cache/nginx/client_temp <br />–http-proxy-temp-path=/var/cache/nginx/proxy_temp <br />–http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp <br />–http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp <br />–http-scgi-temp-path=/var/cache/nginx/scgi_temp <br />–user=nginx <br />–group=nginx <br />–with-http_ssl_module <br />–with-http_realip_module <br />–with-http_addition_module <br />–with-http_sub_module <br />–with-http_dav_module <br />–with-http_flv_module <br />–with-http_mp4_module <br />–with-http_gunzip_module <br />–with-http_gzip_static_module <br />–with-http_random_index_module <br />–with-http_secure_link_module <br />–with-http_stub_status_module <br />–with-mail <br />–with-mail_ssl_module <br />–with-file-aio <br />$(WITH_SPDY) <br />–with-cc-opt="$(CFLAGS)" <br />–with-ld-opt="$(LDFLAGS)" <br />–add-module=../nginx-push-stream-module \ # 就加這一行而已
–with-ipv6
dh_auto_build


#執行

dpkg-buildpackage -b

這樣就包好,可以安裝測試了,不想要更新的話,就把他版本 hold 住


最近試了, socket.iosockjs 還是都沒有讓人覺得很滿意

看看國外 disqus 推荐的 https://github.com/wandenberg/nginx-push-stream-module

還蠻簡單用的,而且複雜性低,不用多加掛一個 socket server ,就交給 nginx 負責 pub 及 sub 的部份,架構算乾淨,自己的下一個玩具,就用他了