BOSH模块未启动:Ejabberd / Strophe设置问题

8

我尝试在Ubuntu 12(Linode最新版本)上使用内部Ejabberd Web服务器设置Strophe与Ejabberd,并用其提供聊天服务。

测试URL (http-bindadmin) 都可用。
JWChat 可用。
Strophe 抛出错误:

In Strophe:
RECV: <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='internal-server-error'>BOSH module not started</body>

In ejabberd.log:  
E(<0.468.0>:ejabberd_http_bind:1236) : 
You are trying to use BOSH (HTTP Bind) in host "admin", but the module mod_http_bind is not started in that host. 
Configure your BOSH client to connect to the correct host, or add your desired host`

安装过程很直接(虽然花了相当一段时间才弄清楚):

  1. 使用sudo apt-get安装
  2. 在sudo下运行
  3. 使用内部服务器,避免与代理冲突或设置PunJab。
  4. 在ejabberd.cfg中进行更改。

ejabberd.cfg的更改:

%% In listening ports, amended the following lines:  
{ request_handlers,  [   
   {["pub"], mod_http_fileserver},   
   {["http-bind"], mod_http_bind}  
]},  

%% In modules, added the following:  
{ mod_http_fileserver, [   
   {docroot, "/var/lib/ejabberd/www"},   
   {accesslog, "/var/log/ejabberd/access.log"}   
]},  
{mod_http_bind,  []},

非常感谢您的帮助。

1个回答

6
答案是相当明显的。
Strophe 要求使用以下格式的用户名:  

username@host
比如,admin@example.com

否则它会假设用户名实际上就是主机名,并且由于这样的主机不存在,因此会抛出一个错误,“mod_http_bind 在该主机上未启动”。
这个错误最多只能算是误导性的,但它在技术上解释了这个问题。我尝试使用只有用户名的方式进行登录[在 JWChat 中有效],所以出现了这个问题。
如果这不能解决问题,还有一些其他需要验证的事项:
  1. Make sure that your domain is added to /etc/hosts

    127.0.0.1    localhost.localdomain   localhost
    12.34.56.78  squire.example.com  squire
    
  2. Make sure that your domain is added to /etc/ejabberd/ejabberd.cfg

    %% Hostname
    Hostname {hosts, ["example.com","98.765.43.21","localhost"]}.
    
  3. Ensure that your username exists and is registered:

    ejabberdctl register username example.com password
    

    And if user is an admin, is included in ejabberd.cfg [Note: it must also be registered!]

    %% Admin user
    {acl, admin, {user, "", "localhost"}}.
    {acl, admin, {user, "admin", "example.com"}}.
    
  4. Check that the server is running:

    a. sudo ejabberdctl status  
    b. http://example.com:5280/admin  
    c. http://example.com:5280/http-bind
    
  5. If there are issues, restart using both (I know you don't need both in theory. In practice, sometimes using one or the other would not work right.)

    sudo /etc/init.d/ejabberd restart
    sudo ejabberdctl restart
    
  6. Check the logs - /var/log/ejabberd/ejabberd.log (see here).

  7. Install JWChat and try that (or, if you have JWChat, install Strophe).
    The following short tutorial is invaluable, follow it exactly: http://www.ejabberd.im/jwchat-localserver


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接