Monday, January 16, 2006

Step 3 - Configure Web Interface for Nagios

To Set up The Web Interface for Nagios

In these instructions I will assume that you are running the Apache web server on your machine. If you are using some other web server, you'll have to make changes where appropriate. I am also assuming that you used the /usr/local/nagios as the installation prefix.

Configure Script Alias For The CGIs

You'll need to create an alias for the CGIs as well. The default installation expects to find them accessible at http://yourmachine/nagios/cgi-bin/, although this can be changed using the --with-cgiurl option in the configure script. Anyway, add something like the following to your web server configuration file (i.e. httpd.conf) (changing it to match any directory differences on your system)...

ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/

AllowOverride AuthConfig
Options ExecCGI
Order allow,deny
Allow from all



Important! The Script-Alias line above must come before the Alias line below. Otherwise Apache will parse the lines differently.

Important! If you are installing Nagios on a multi-user system, you may want use CGIWrap to provide additional security between the CGIs and the external command file. If you decide to use CGIWrap, the ScriptAlias you'll end up using will most likely be different from that mentioned above. More information on doing this can be found here.

Configure Alias For The HTML Files

In order to make the HTML files accessible via the web server, you'll have to edit your Apache configuration file as follows...

Add the following to your web server configuration file (i.e. httpd.conf) as follows:

Alias /nagios/ /usr/local/nagios/share/

Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all


This will allow you to use an URL like http://yourmachine/nagios/ to view the HTML web interface and documentation. The alias should be the same value that you entered for the --with-htmurl argument to the configure script (default is /nagios/).

Important! The Alias directive you just added for the HTML files must come after the ScriptAlias directive for the CGIs. If it doesn't, you'll get a 404 error when attempting to access the CGIs.

Restart The Web Server

Once you've finished editing the Apache configuration file, you'll need to restart the web server with a command like this...

/etc/rc.d/init.d/httpd restart

No comments: