	Enabling mod_caml and general configuration
	-------------------------------------------

Locate mod_caml.so, and add the following line to Apache's httpd.conf:

  LoadModule caml_module /path/to/mod_caml.so


	Configuring mod_caml for running CGI scripts written in OCaml
	-------------------------------------------------------------

mod_caml comes with a standard module called Registry which is used
for running CGI scripts. To set this up, you will need to:

(a) Create a caml-bin directory to store your compiled scripts.
(b) Write some scripts, compile them, and put them in this directory.
(c) Locate registry.cmo (the Registry module). It's usually in
    `/usr/share/mod_caml/registry.cmo'.
(d) Configure Apache and restart.

On Linux a good place to create your caml-bin directory might be under
/var/www/caml-bin, or wherever local convention dictates. The
directory should be world read / world exec (eg. chmod 0755 /var/www/caml-bin).

To write a script, I suggest looking at an example from the
example-scripts subdirectory of the source distribution and
modifying. For now just use 'hello.cmo' which is the compiled hello
world example. Copy this file to /var/www/caml-bin/ and make sure it
is world-readable (eg. chmod 0644 /var/www/caml-bin/hello.cmo).

Now add the following configuration to Apache's httpd.conf (or better
in `apxs -q SYSCONFDIR`/conf.d/mod_caml):

  CamlLoad /usr/share/mod_caml/registry.cmo
  Alias /caml-bin/ /var/www/caml-bin/            # or wherever it is
  <Location /caml-bin>
    SetHandler ocaml-bytecode
    CamlHandler Registry.handler
    Options ExecCGI
    Allow from all
  </Location>

Here is an alternative method if you want .cmo files to be executed
wherever they are [thanks to Loic Le Loarer]:

  CamlLoad /usr/share/mod_caml/registry.cmo
  CamlHandler Registry.handler
  AddHandler ocaml-bytecode .cmo

Restart Apache and check it works by visiting
http://your.server/caml-bin/hello.cmo . If it doesn't then you'll need
to consult Apache's error log to find out what went wrong.


	Running CGI scripts requiring libraries
	---------------------------------------

If you want to run scripts that depend on libraries, you must load
these with a CamlLoad command first (e.g. in httpd.conf).  If the
module is located in the standard library directory (ocamlc -where),
you can just refer to it with a relative path:

  CamlLoad nums.cma
  CamlLoad threads/threads.cma

Otherwise, you must precise the full path, e.g.

  CamlLoad /usr/local/lib/ocaml/3.08.2/dbi/dbi.cma


	Configuring mod_caml to run other Apache handlers
	-------------------------------------------------

We'll use the simple Print_trans module in this example. This is an
Apache translation handler which doesn't actually do any URI
translation. It just prints out the URI to the Apache error log.  The
compiled module is called print_trans.cmo and mod_caml infers the
module name from the name of the compile module file (it removes any
directory name and extension and capitalises to give the result
Print_trans). This module registers a single handler called "handler".

To configure the module we simply add the following to Apache's
httpd.conf:

  CamlLoad /path/to/example-handlers/print_trans.cmo
  CamlTranslateHandler Print_trans.handler

If you restart Apache and fetch a few pages from the server, you should
see some messages in the logs listing URIs.
