1.安装Erlang,ejabberd是用Erlang开发的
下载最新Erang版本 http://www.erlang.org/
tar -xvf otp-src-R12B-0.tar.gz
cd otp-src-R12B-0
sudo ./configure --prefix=/otp/erlang
sudo make
sudo make install
2.下载ejabberd,采用默认路径安装
./configure --with-erlang=/usr/local/erlang(支持数据库方式(参考http://www.process-one.net/en/ejabberd/guide_en#htoc32 数据库表在源码包中的src中):./configure --enable-odbc --with-erlang=/usr/local/erlang)
sudo make
sudo make install
The files and directories created are, by default:
/etc/ejabberd/
Configuration directory:
ejabberd.cfg
ejabberd configuration file
ejabberdctl.cfg
Configuration file of the administration script
inetrc
Network DNS configuration file
/lib/ejabberd/
ebin/
Erlang binary files (*.beam)
include/
Erlang header files (*.hrl)
priv/
Additional files required at runtime
bin/
Executable programs
lib/
Binary system libraries (*.so)
msgs/
Translation files (*.msgs)
/sbin/ejabberdctl
Administration script (see section 4.1)
/share/doc/ejabberd/
Documentation of ejabberd
/var/lib/ejabberd/
Spool directory:
.erlang.cookie
Erlang cookie file (see section 5.3)
acl.DCD, ...
Mnesia database spool files (*.DCD, *.DCL, *.DAT)
/var/log/ejabberd/
Log directory (see section 7.1):
ejabberd.log
ejabberd service log
erlang.log
Erlang/OTP system log
配置:
安装完毕 后修改 ejabberd.cfg
Make sure you have options similar to those on your ejabberd.cfg:
{hostss, ["www.aa.com"]}.
{listen,
...
{5280, ejabberd_http, [http_poll]}With these options the URL for HTTP-Poll in your server will be:
http://www.aa.com:5280/http-poll/
启动ejabberd:
cd /ebin
./ejabberdctl start
添加管理帐号:./ejabberdctl register admin www.aa.com 123456
访问http://www.aa.com:5280/admin
用 admin@www.aa.com 登陆 pwd 123456 (刚才添加的管理帐号)
3.下载ejabberd 客户端。有很多,例子里使用jwchat(ajax实现),解压后放到你的项目文件夹下,/root/jwchat
配置config.js 设置var SITENAME = "www.aa.com";
4.配置apache(2.2.4) 加载rewrite,proxy模块
1.在apache 安装文件/modules/mappers/mod_rewrite.c
/usr/local/apache/bin/apxs -c -i -a mod_rewrite.c
2.在apache 安装文件/modules/proxy下
/usr/local/apache/bin/apxs -c -i -a mod_proxy.c proxy_util.c
/usr/local/apache/bin/apxs -c -i -a mod_proxy_http.c mod_proxy_balancer.c mod_proxy_connect.c
在httpd.conf中保证在有如下内容
LoadModule rewrite_module modules/mod_rewrite.so
(注意下面的先后顺序)
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
3.配置.htaccess 放在 /root 下:
AddDefaultCharset UTF-8
Options +MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule http-poll/ http://www.aa.com:5280/http-poll/ [P]
RewriteRule http-bind/ http://www.aa.com:5280/http-bind/ [P]
</IfModule>
参考:
http://www.ejabberd.im/jwchat-apache
http://www.process-one.net/en/ejabberd/guide_en
http://www.koven.org/archives/ejabberd-mod-archive.html
ejabberd聊天记录插件mod_archive