分享

openfire+jwchat+nginx搭建XMPP的webim

 WindySky 2016-07-05

openfire+jwchat+nginx搭建XMPP的webim

 

Openfire是一个强大的即时消息(IM)和聊天服务器,它实现了XMPP协议,下载

http://www./projects/openfire/

jwchat是XMPP的一个客户端实现,下载

http://blog./jwchat/

nginx作为jwchat的运行容器,实现http-bind,下载

http:///

 

下载后先安装Openfire,安装比较简单,

window下解压后,进入bin下面,运行openfire.exe,

启动服务,浏览器输入http://localhost:8080,然后按提示安装即可

 

nginx安装,window下nginx解压即可用。

 

jwchat解压,使用中文版,所以把jwchat目录下面的.zh_CN为后缀的都去掉。

把整个目录拷贝到nginx的html下面

 

配置jwchat的config.js文件

var SITENAME = "localhost"; #服务器的ip,非本机改为特定ip或者服务

 

Js代码  收藏代码
  1. var BACKENDS =   
  2. [  
  3.           
  4.         {  
  5.             name:"Native Binding",  
  6.             description:"Ejabberd's native HTTP Binding backend",  
  7.             httpbase:"/http-bind/",  
  8.             type:"binding",  
  9.             servers_allowed:[SITENAME]  
  10.         },  
  11.         /*这部分注释掉 
  12.         { 
  13.             name:"Native Polling", 
  14.             description:"Ejabberd's native HTTP Polling backend", 
  15.             httpbase:"/http-poll/", 
  16.             type:"polling", 
  17.             servers_allowed:[SITENAME] 
  18.         }, 
  19.         { 
  20.             name:"Open Relay", 
  21.             description:"HTTP Binding backend that allows connecting to any jabber server", 
  22.             httpbase:"/jhb/", 
  23.             type:"binding", 
  24.             default_server: SITENAME 
  25.         }, 
  26.         { 
  27.             name:"Restricted Relay", 
  28.             description:"This one let's you choose from a limited list of allowed servers", 
  29.             httpbase:"/JHB/", 
  30.             type:"binding", 
  31.             servers_allowed:[SITENAME,'jabber.org',''] 
  32.         } 
  33.         */  
  34. ];  

 

配置nginx

在nginx的conf文件下打开nginx.conf,添加http-bind的代理设置

#在

#gzip  on;

#下增加

Java代码  收藏代码
  1. upstream openfire {  
  2.         server 127.0.0.1:7070;  
  3.     }  

 在

location / {

        root   html;

        index  index.html index.htm;

    }

之上增加

Java代码  收藏代码
  1. location /http-bind {  
  2.         proxy_pass http://bk.openfire;  
  3.         proxy_buffering off;  
  4.         proxy_redirect off;  
  5.         proxy_read_timeout 120;  
  6.         proxy_connect_timeout 120;  
  7.     }  
 配置完成,启动nginx,然后浏览器访问

http://localhost/jwchat使用

 


 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多