Monday, January 16, 2006

Step 4 - Configure .htaccess for Password Authentication

Password Authentication for Below Directories

/usr/local/nagios/sbin
/usr/local/nagios/share

The next step is to create a file named .htaccess in the root your CGI directory (and optionally also you HTML directory) for Nagios (usually /usr/local/nagios/sbin and /usr/local/nagios/share, respectively). The file(s) should have contents similiar to the following...

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user


Now to create the Users
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

Password I added as admin

Okay, so you're done with this part of what needs to be done. If you point your web browser to your Nagios CGIs you should be asked for a username and password. If you have problems getting user authentication to work at this point, read your webserver documentation for more info.

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

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.

To Troubleshoot any errors on Apache Server Check the logs

#tail -f /var/log/httpd/error_log

No comments: