apache2.4 配置nagios虚拟主机,暂时先记录下面,注释掉了认证。
记得去httpd的主配置文件开启cgi模块,
LoadModule cgid_module modules/mod_cgid.so
LoadModule cgi_module modules/mod_cgi.so
另外我还自己添加了句AddType application/cgi-script .cgi ,可是注释掉这句也可以正常使用,那就留着备用吧。
<VirtualHost *:80> # ServerAdmin admin@a.com DocumentRoot "/usr/local/nagios/share" ServerName nagios.a.com ErrorLog "/var/log/httpd/nagios.a.com-error_log" CustomLog "/var/log/httpd/nagios.a.com-access_log" common <Directory "/usr/local/nagios/share"> Options None AllowOverride None Require all granted # php_flag engine on # php_admin_value open_basedir /usr/local/www/nagios/:/var/spool/nagios/ </Directory> <Directory "/usr/local/nagios/cgi-bin"> Options ExecCGI </Directory> </VirtualHost>
另外我关闭了认证,所以在nagios web界面会提示
It appears as though you do not have permission to view information for any of the services you requested
打开nagios/etc/cgi.cfg配置文件,里面有个参数:
use_authentication=1
为了保障系统的安全性,nagios设置了这个参数,默认为1,改为0即可