OpenFire + jwchat 即时消息最新版安装调试

来源:互联网 发布:阿里农村淘宝 编辑:程序博客网 时间:2024/05/29 04:57

最近在研究即时通讯,在网上找了许多文章,但大多是老版本的安装而且不全面,下面介绍最新版本的安装:

 

一.准备

jdk1.6 (忽略安装配置)

apache2.2 (忽略安装配置)

mysql 5(忽略安装配置)

 

openfire_3_6_4.zip (服务器)

jwchat-1.0.zip(HTML WEB客户端)

jsjac-1.3.2.zip(用于调试jsjac,即WEB与服务器通讯)

一定要注意版本,否则老版本和jwchat-1.0安装会不顺畅!

 

二、安装

 

openfire直接解压,运行bin目录中的openfire.exe并按启动,打开IE,输入http://yown(机器名或域名):9090 ,按照提示安装服务器即可。

 

jwchat-1.0安装:(假设我们将jwchat安装到c:/apache_yown/htdocs/jwchat下,apache端口为80)

1.解压后,将 *.js.js改为*.js, *.html.html 改为*.html

可以将jwchat放到linux下(为了方便,当然也可以用其它工具批量重命名),执行:

 rename ".js.js" ".js" *.js.js

 rename ".html.html" ".html" *.html.html

中文界面则需修改“.zh_CN”结尾的文件名

 rename ".js.zh_CN" ".js" *.js.zh_CN

 rename ".html.zh_CN" ".html" *.html.zh_CN


重命名完成后,再拷到原目录

 

2.检查Apache 2的/usr/local/apache2/modules目录下是否包含 mod_proxy.so, mod_proxy_http.so和mod_rewrite.so,如果没有则需要重新编译apache 在build时需要在./configure命令行上添加
a)         enable-rewrite=shared
b)        enable-proxy=shared
c)        enable-proxy-http=shared

检测/apache2/conf/httpd.conf文件中是否包含如下配置,如果没有需要手工添加

a)         LoadModule rewrite_module modules/mod_rewrite.so

b)        LoadModule proxy_module modules/mod_proxy.so

c)        LoadModule proxy_http_module modules/mod_proxy_http.so

在/apache2/conf/httpd.conf文件尾部添加如下配置

AddDefaultCharset UTF-8

Options +MultiViews

RewriteEngine On

ProxyPass /http-bind/ http://yown:7070/http-bind/

这里的7070端口是OpenFire默认的HTTP Binding端口,可在OpenFire的管理控制台上修改

 

注意:为什么要通过apache重定向呢,原来是因为As most browser don't allow scripts to connect to a different domain and/or port as they have been loaded from you'd have to find a way how to access this service at some URI hosted at http://example.com/.请见jsjac-1.3.2/README

 

 


3.在OpemFire的管理控制台增加两个服务器属性:
xmpp.httpbind.client.requests.polling = 0
xmpp.httpbind.client.requests.wait = 10

 

打开浏览器,运行http://yown/jwchat/,在“Choose Backend”选择“Native Binding”,输入用户名和密码即可登陆

 

 若出现“authorization failed”,则可能是SSL不支持的原因,需要修改jsjac.js,在if(this.has_sasl) 前面加上this.has_sasl=false;

 

原创粉丝点击