Installing Nagios 4 on Debian 12.

This is a draft with just the pertinent notes of the problems I had.  I will update this in the near future and do a comprehensive install guide.

Install Nagios and all it’s dependencies.  Then start and enable apache2 and Nagios4

apt update
apt upgrade
apt install nagios4 nagios4-common monitoring-plugins-contrib
systemctl enable nagios4
systemctl is-enabled nagios4
systemctl status nagios4
systemctl is-enabled apache2
systemctl status apache2

Configure the login password.

htpasswd /etc/nagios4/htdigest.users nagiosadmin

Enable apache2 modules

a2enmod cgi cgid rewrite
systemctl restart apache2

Turn on authentication for cgi in /etc/nagios4/cgi.cfg

use_authentication=1

Edit /etc/apache2/conf-available/nagios4-cgi.conf

# apache configuration for nagios 4.x

ScriptAlias /cgi-bin/nagios4 /usr/lib/cgi-bin/nagios4
ScriptAlias /nagios4/cgi-bin /usr/lib/cgi-bin/nagios4

# Where the stylesheets (config files) reside
Alias /nagios4/stylesheets /etc/nagios4/stylesheets

# Where the HTML pages live
Alias /nagios4 /usr/share/nagios4/htdocs

<DirectoryMatch (/usr/share/nagios4/htdocs|/etc/nagios4/stylesheets)>
  Options None
  AllowOverride None
  <RequireAll>
    # Require all granted
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /etc/nagios4/htdigest.users
    Require valid-user
  </RequireAll>
</DirectoryMatch>

<Directory (/usr/lib/cgi-bin/nagios4)>
  AddHandler cgi-script .cgi
  Options ExecCGI
  AllowOverride None
  <RequireAll>
    # Require all granted

    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /etc/nagios4/htdigest.users
    Require valid-user
  </RequireAll>
</Directory>

<Location /cgi-bin/nagios4>
  AuthName "Nagios Access"
  AuthType Basic
  AuthUserFile /etc/nagios4/htdigest.users
  require valid-user
</Location>

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.