13.2. Configuring Apache for Nagios
Problem
You can read the Nagios HTML docs in a local web browser or HTML-enabled file browser like Konqueror, but Apache doesn't seem to know they exist. Nagios needs Apache support to be fully functional and to display all the status pages and command pages. How do you make it go?
Solution
You need to use Apache's access controls. First, create an Apache password for the Nagios user:
# cd /usr/local/nagios/etc/
# htpasswd -c htpasswd.users nagios
New password:
Re-type new password:
Adding password for user nagiosThen, make the password file owned and readable/writable only by the HTTP user:
# chown HTTP user htpasswd.users
# chmod 0600 htpasswd.usersOn Fedora, add this directive to your /etc/httpd/conf/httpd.conf file:
Include /etc/httpd/conf.d
Next, create /etc/httpd/conf.d/nagios. On
Debian. create /etc/apache2/conf.d/nagios. Add
these directives to the file, using your own subnet on the line
Allowfrom192.168.1.:
## conf.d/nagios ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin <Directory "/usr/local/nagios/sbin"> Options ExecCGI AllowOverride None Order allow,deny HostnameLookups On Allow from localhost Allow from 127.0.0.1 Allow from 192.168.1. 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 HostnameLookups On Allow from localhost Allow from 127.0.0.1 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access