NUT HTML complementary information
==================================
Arnaud Quette <arnaud.quette@free.fr>, Dave Breiland <superdave@dynamicis.com>
v1.0, 27 Jul 2005 (start date)

This file provides some complementary information
about the use and integration of NUT HTML pages.

1) Introduction
---------------

NUT HTML pages have been created as a central point
that ease the access to the various CGI scripts
providing the NUT web interface.

It consists of three HTML files:

* `index.html`: defines the two container frames,
  `topFrame` and `mainFrame`
* `header.html`: contains the header including links
  to NUT website, and `upsstats.cgi`/`upsset.cgi`
* `bottom.html`: empty frame that will be replaced
  with the content of `upsstats.cgi` or `upsset.cgi`.

2) Integration
--------------

You first need to install NUT CGI, i.e. using
----
:; ./configure --with-cgi
----

Refer to the NUT documentation for more information.

There are two ways to integrate NUT HTML with your
webserver, with the same results:

a) take advantage of the existing tree
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- the cgi programs are (for example) installed in `/usr/lib/cgi-bin`,
  which is already configured in your webserver as the default CGI path

- in the same spirit, we will use the existing `DocumentRoot` (in terms
  of Apache webserver) and create a `nut` subdirectory, and copy the
  three `.html` files (`index`, `header` and `bottom`)

Note that the links to cgi programs in `header.html` are pre-configured
to work in this situation, which eases the packagers' work.

b) configure manually
~~~~~~~~~~~~~~~~~~~~~

- copy the `data/html` directory to some path (i.e. `/usr/local/nut`
  for a standard installation from source)

- Now edit your webserver configuration file, adding for
  example (for Apache):
+
----
#Begin Section
ScriptAlias /nut/cgi-bin/ /usr/local/nut/cgi-bin/
<Directory "/usr/local/nut/cgi-bin/">
    AllowOverride AuthConfig
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>

Alias /nut/ /usr/local/nut/html/
<Directory "/usr/local/nut/html/">
    Options None
    AllowOverride AuthConfig
    Order allow,deny
    Allow from all
</Directory>
#End Section
----

- Make sure to change the links path in `header.html` according to your
  configuration and installation.

3) Conclusion
-------------

- Make sure to restart your webserver.

- Configure the CGI scripts.  Man pages can be found from:
+
----
:; man -M /usr/local/nut/man/ upsstats.cgi
:; man -M /usr/local/nut/man/ upsset.cgi
:; man -M /usr/local/nut/man/ upsimage.cgi
:; man -M /usr/local/nut/man/ hosts.conf
----

- It is recommended that you use `.htaccess` files in the `cgi-bin` folder
  and the `html` folder.  Please reference:
  http://httpd.apache.org/docs/howto/htaccess.html

- You will then be able to access the NUT HTML page at:
  http://localhost/nut

- Further protection with HTTPS is recommended, especially for installations
  on networks accessible by someone other than yourself.
