nagios如何修改Apache?首先安装Apache服务,安装完成后,修改apache的配置文件,增加nagios的目录,并且访问此目录需要进行身份验证。(注:如果不要设置身份验证,在httpd.conf 最后增加的内容注释掉“加粗字体”部分)
vi /usr/local/apache/conf/httpd.conf
#======================= Nagios Suport =========================#
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
<Directory "/usr/local/nagios/sbin">
# 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.zhaohang
# AuthUserFile /usr/local/nagios/etc/htpasswd.admin
Require valid-user
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
# 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.zhaohang
# AuthUserFile /usr/local/nagios/etc/htpasswd.admin
Require valid-user
</Directory>
#======================= Nagios Suport =========================#
增加验证用户: 也就是通过web访问nagios的时候,必须要使用用这个用户才可以登陆,有时为了长时间监控刷新,避免输入密码麻烦就不加密码.注释红的行可以达到要求. 用户:zhaohang 密码为:123456
/usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.zhaohang zhaohang
# /usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.admin admin
查看认证文件的内容:
less /usr/local/nagios/etc/htpasswd.zhaohang
test:OmWGEsBnoGpIc 前半部分是用户名test,后面是加密后的密码。
nagios的安装到这里为止也就基本完成了,你可以通过web来访问了,http://192.168.0.108/nagios/.