Notes
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.
Sample Configuration
A sample Apache config file snippet is created when you run the configure script - you can find the sample config file (named httpd.conf) in the sample-config/ subdirectory of the Nagios distribution. You will need to add the contents of this file to your Apache configuration files before you can access the Nagios web interface. The instructions found below detail how to manually add the appropriate configuration entries to Apache.
Configure Aliases and Directory Options For The Web Interface
First you'll need to create appropriate entries for the Nagios web interface (HTML and CGIs) in your web server config file. Add the following snippet 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 <Directory "/usr/local/nagios/sbin"> Options ExecCGI AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user </Directory> Alias /nagios /usr/local/nagios/share <Directory "/usr/local/nagios/share"> Options None AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user </Directory>
Note: The default Nagios installation expects to find the HTML files and CGIs at http://yourmachine/nagios/ and http://yourmachine/nagios/cgi-bin/, respectively. These locations can be changed using the --with-htmurl and --with-cgiurl options in the configure script.
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.
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
Configure Web Authentication
Once you have installed the web interface properly, you'll need to specify who can access the Nagios web interface. Follow these instructions to do this.
Verify Your Changes
Don't forget to check and see if the changes you made to Apache work. You should be able to point your web browser at http://yourmachine/nagios/ and get the web interface for Nagios. The CGIs may not display any information, but this will be remedied once you configure everything and start Nagios.