JWChat with ejabberd using http_bind method for BOSH and lighttpd's mod_proxy

If you don't use ejabberd, you will need to set up your jabber server (and maybe an external service) for http_bind (BOSH)

Ejabberd setup

You need to enable http_bind (BOSH), this is pretty simple, except that most howtos won't tell you to enable the module, just the listener, so here is how it is done, this howto uses port 5280 for this, but it could be any.

in ejabberd.cfg in the {listen, part

  {5280, ejabberd_http, [
                         http_bind,
                         web_admin
                        ]},                                                                                                     

the http_bind part is important. Then in the {modules, part, add

  {mod_http_bind,[]},

lighttpd setup

ligttpd.conf: in the server.modules = ( you will need to enable

  "mod_proxy",

then i added a host with the following directives:

$HTTP["host"] == "your.webjab.tld" {
    server.document-root = "/path/to/jwchat/root"
    proxy.server = (
                    "http-bind/" =>
                        ( (
                            "host" => "127.0.0.1",
                            "port" => 5280
                        ) ),
                   )
}

JWChat setup

#if you want localized versions, substitute .html.html to .html.yourlang, where yourlang is, well, your localized language's code ;)
   $ for file in $(find . -name '*.html.html'); do
       cp $file $(echo $file |sed 's,.html$,,g')
     done
  and .js.js files:
#if you want localized versions, substitute .js.js to .js.yourlang, where yourlang is, well, your localized language's code ;)
  $ for file in $(find . -name '*.js.js'); do
      cp $file $(echo $file |sed 's,.js$,,g')
    done
var SITENAME = "your_jabber_host.tld";

//we removed all non-relevant backends:
var BACKENDS =
[
                {
                        name:"Native Binding",
                        description:"Ejabberd's native HTTP Binding backend",
                        httpbase:"/http-bind/",
                        type:"binding",
                        servers_allowed:[SITENAME]
                },
];
  rm *.html.* *.js.*

That's all folks, if you have any ideas on how i can make this howto better, contact me