Ura718
Ura718

Reputation: 421

How does one change nagios default url to custom url?

I am running Nagios Core 4.0.8 in my environment and I am looking to find a way to change the default url from https://example.com/nagios to https://example.com. Is there a way one can do that?

Upvotes: 4

Views: 14096

Answers (2)

George Ulahannan
George Ulahannan

Reputation: 91

You will need to edit the cgi.cfg file for Nagios.

  1. vim /usr/local/nagios/etc/cgi.cfg

    Change url_html_path=/nagios to url_html_path=/

  2. Edit nagios.conf:

    Change ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin" to ScriptAlias /cgi-bin "/usr/local/nagios/sbin"

    Comment out the line Alias /nagios "/usr/local/nagios/share" and then add below

    DocumentRoot /usr/local/nagios/share

    Add the following at top of the configuration:

    <VirtualHost *:80> ServerName status.example.com

    and add </VirtualHost> at the bottom.

  3. Edit your /usr/local/nagios/share/config.inc.php file:

    Change $cfg['cgi_base_url']='/nagios/cgi-bin'; to $cfg['cgi_base_url']='/cgi-bin';

  4. Restart Apache and Nagios

Upvotes: 8

Xacosta
Xacosta

Reputation: 246

If you are using Apache to serve your Nagios page you can do different things. Apache configuration files are usually located in /etc/apache2/.

Probably your DocumentRoot is set to /var/www, so you can create a file named "index.html" and place this code inside it to redirect to /nagios URL:

<META HTTP-EQUIV="Refresh" Content="0; URL=/nagios">

You can also edit your nagios apache config (probably /etc/nagios/apache2.conf...) or apache config /etc/apache2/*.conf and add:

RedirectMatch ^/$ /nagios

If you don't like these methods there are more, just think of it as using Apache to redirect, not like a Nagios thing.

Upvotes: 3

Related Questions