Reputation: 421
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
Reputation: 91
You will need to edit the cgi.cfg file for Nagios.
vim /usr/local/nagios/etc/cgi.cfg
Change url_html_path=/nagios
to url_html_path=/
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.
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';
Restart Apache and Nagios
Upvotes: 8
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