Tips - Change Nagios default URL access

Tips - Change Nagios default URL access

By default, the Nagios URL is http(s)://<subdomain>.<domain>/nagios. If you want to change the default Nagios path to another path, then the information below can help you.
Benedikt Geyer©

  1. Prerequisites
  2. The Tips

Prerequisites

  • A web serveur must be installed and configured
  • Nagios must be installed and configured

The Tips

  1. You will need to edit the /usr/local/etc/nagios/cgi.cfg file for Nagios
    sudo vi /usr/local/nagios/etc/cgi.cfg
    
    • Change url_html_path=/nagios to url_html_path=/<new_url_html_path>
  2. Edit /usr/local/etc/nagios/nagios.conf
    sudo vi /usr/local/etc/nagios/nagios.conf
    
    • Change ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin" to ScriptAlias /<new_url_html_path>/cgi-bin "/usr/local/nagios/sbin"
    • Change the line Alias /nagios "/usr/local/nagios/share/htdocs" to Alias /<new_url_html_path> "/usr/local/nagios/share/htdocs"
  3. Edit your /usr/local/nagios/share/config.inc.php file
    sudo vi /usr/local/nagios/share/config.inc.php
    
    • Change $cfg['cgi_base_url']='/nagios/cgi-bin'; to $cfg['cgi_base_url']='/<new_url_html_path>/cgi-bin';
  4. Restart apache or nginx and nagios
Share it :