Friday, January 29, 2010

Ejabber Installation using Apache

This tutorial is based on the original JWChat README files and it will guide you through the installation of the web-based Jabber client JWChat 1.0 beta 2 using a pre-generated package.

At the end, you will have JWChat running using ejabberd's internal HTTP Polling support. In case you, however, want to use the external component JabberHTTPBind instead, you should take a look at The odyssey of JWChat by Sabine Dinis Blochberger.

Please post a comment to this tutorial to suggest something, to report errors, or to report system and web server specific instructions. Naturally, you also can add a comment if you have questions. Further, you can ask JWChat specific questions in the chatroom jwchat@conference.jwchat.org.

  1. Configure ejabberd

    Make sure you have options similar to those on your ejabberd.cfg:

    {host, "jabber.mycompany.com"}.

    {listen,
    ...
    {5280, ejabberd_http, [http_poll]}

    With these options the URL for HTTP-Poll in your server will be:

    http://jabber.mycompany.com:5280/http-poll/
  2. Download JWChat

    Download a pre-generated package of JWChat and unpack it.

  3. Configure JWChat

    Edit config.js to suit your needs. You must at least set this option:

    var SITENAME = "jabber.mycompany.com"
  4. Copy to www

    Now you can copy the JWChat directory to its final destination. On Linux it could be /var/www/jwchat/

  5. Setup webserver

    Now you have to setup your web server so that it redirects requests from the URL given at HTTPBASE of config.js to an HTTP-Polling capable Jabber server component. Those instructions are for Apache 2.

    • .htaccess

      The easiest way to make redirection is creating a .htaccess file in the JWChat directory with this content:

      AddDefaultCharset UTF-8
      Options +MultiViews

      RewriteEngine On
      RewriteRule http-poll/ http://jabber.mycompany.com:5280/http-poll/ [P]
      In your Apache configuration file (/etc/apache2/apache2.conf) you must enable .htaccess files and proxy options:

      AllowOverride All

      Finally, enable rewrite and proxy modules for Apache:

      cd /etc/apache2
      ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
      ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/
      ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/
    • virtual host

      undocumented

    Restart your web server so changes take effect:

    apache2ctl restart

    And now you can open your browser in the URL (maybe similar to http://www.mycompany.com/jwchat/).

No comments:

Post a Comment