NagiosConfiguration inApacheThe service is as follows:
Configure Apache service:
1. Back up the master configuration file of the Apache service
[Root @ KCentOS5C ~] # Cp/etc/httpd/conf/httpd. conf/etc/httpd/conf/httpd. conf. backup
2. Configure the main configuration file of the Apache service
[Root @ KCentOS5C ~] # Vi/etc/httpd/conf/httpd. conf
Here we mainly change the following parameters:
-----------------------------------------------------
ServerName *: 80
Configure the Apache server name. If there is a domain name, enter the correct server name.
Include conf. d/*. conf
Confirm the path for storing the Apache extension configuration file.
-----------------------------------------------------
3. view the Nagios webpage configuration Template File
[Root @ KCentOS5C ~] # Less nagios-2.9/sample-config/httpd. conf
-----------------------------------------------------
# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005
#
# This file contains examples of entries that need
# To be ininitialized ated into your Apache web server
# Configuration file. Customize the paths, etc.
# Needed to fit your system.
ScriptAlias/nagios/cgi-bin "/usr/local/nagios/sbin"
Set the system path corresponding to the CGI execution directory of Nagios.
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow, deny
Allow from all
# Order deny, allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile/usr/local/nagios/etc/htpasswd. users
Access to the user account library file is specified here.
Require valid-user
Alias/nagios "/usr/local/nagios/share"
Set the system path of the Nagios webpage URL.
# SSLRequireSSL
Options None
AllowOverride None
Order allow, deny
Allow from all
# Order deny, allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile/usr/local/nagios/etc/htpasswd. users
The access to the user account library file is specified here
Require valid-user
Basically, this file can be used directly. According to the AuthUserFile item specified in this configuration file, it specifies that the account list library file of Valid users of Nagios is accessed through Apache. You need to use the htpasswd command to add users to this list library. By default, the file htpasswd. user does not exist in the/usr/local/nagios/etc/directory. Therefore, you must manually add the file. Please note that htpasswd created as root. the permission of the user file should be changed to the nagios group ownership immediately after the file is created, and the read and write permissions of users in the nagios group should be added.