Page 1 of 1

Issues accessing the Nagios web interface

Posted: Mon Jan 24, 2022 2:59 pm
by Datastream101
Hey guys, installed Nagios from the following, https://pimylifeup.com/raspberry-pi-nagios/ and when I try and go to the web interface I get the following page. Is there a particular port to connect ?

Code: Select all

<?php
// Allow specifying main window URL for permalinks, etc.
$url = 'main.php';

if ("no" == "yes" && isset($_GET['corewindow'])) {

	// The default window url may have been overridden with a permalink...
	// Parse the URL and remove permalink option from base.
	$a = parse_url($_GET['corewindow']);

	// Build the base url.
	$url = htmlentities($a['path']).'?';
	$url = (isset($a['host'])) ? $a['scheme'].'://'.$a['host'].$url : '/'.$url;

	$query = isset($a['query']) ? $a['query'] : '';
	$pairs = explode('&', $query);
	foreach ($pairs as $pair) {
		$v = explode('=', $pair);
		if (is_array($v)) {
			$key = urlencode($v[0]);
			$val = urlencode(isset($v[1]) ? $v[1] : '');
			$url .= "&$key=$val";
		}
	}
	if (preg_match("/^http:\/\/|^https:\/\/|^\//", $url) != 1)
		$url = "main.php";
}

$this_year = '2020';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

<html>
<head>
	<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
	<title>Nagios: <?php echo $_SERVER['SERVER_NAME']; ?></title>
	<link rel="shortcut icon" href="images/favicon.ico" type="image/ico">

	<script LANGUAGE="javascript">
		var n = Math.round(Math.random() * 10000000000);
		document.cookie = "NagFormId=" + n.toString(16);
	</script>
</head>

<frameset cols="180,*" style="border: 0px; framespacing: 0px">
	<frame src="side.php" name="side" frameborder="0" style="">
	<frame src="<?php echo $url; ?>" name="main" frameborder="0" style="">

	<noframes>
		<!-- This page requires a web browser which supports frames. -->
		<h2>Nagios Core</h2>
		<p align="center">
			<a href="https://www.nagios.org/">www.nagios.org</a><br>
			Copyright © 2010-<?php echo $this_year; ?> Nagios Core Development Team and Community Contributors.
			Copyright © 1999-2010 Ethan Galstad<br>
		</p>
		<p>
			<i>Note: These pages require a browser which supports frames</i>
		</p>
	</noframes>
</frameset>

</html>
Image

Re: Issues accessing the Nagios web interface

Posted: Fri Jan 28, 2022 8:41 am
by TerminalCondition
If all the moving parts are working right, Nagios should respond to HTTP requests on port 80, and HTTPS requests on port 443. There are a lot of moving parts, but there's nothing special WRT Raspberry Pi here.

It looks like your server is displaying PHP rather than executing PHP. If that's right, then there's probably a misconfiguration in Apache, not Nagios.

Re: Issues accessing the Nagios web interface

Posted: Sun Jan 30, 2022 11:01 am
by Datastream101
Thanks for the reply, how can I test or fix it?

Re: Issues accessing the Nagios web interface

Posted: Tue Feb 01, 2022 11:12 am
by TerminalCondition
I'm not an Apache expert. Caveat emptor.

First, restart Apache, and see whether that fixes the problem. A lot of people forget to restart Apache after they've made changes.

You're running an Ubuntu distribution, right? If so, check /etc/apache2/mods-enabled directory for a php module. This ought to find it, if it's there.

Code: Select all

$ ls /etc/apache2/mods-enabled/*php*.*
If it's there, but Apache still doesn't execute php, I need to think longer. If it's not there, check /etc/apache2/mods-available. You might find something like this.

Code: Select all

$ ls /etc/apache2/mods-available/*php*.*
/etc/apache2/mods-available/php7.2.conf  /etc/apache2/mods-available/php7.2.load
Enable that module with a2enmod. (You might need to use sudo a2enmod.)

Code: Select all

$ a2enmod php7.2
Restart Apache.

If it still doesn't work, maybe try this search.

https://www.google.com/search?q=apache+ ... cuting+php

Re: Issues accessing the Nagios web interface

Posted: Fri Feb 04, 2022 5:29 pm
by Datastream101
Awesome! thanks so much. PHP wasn't there so installed the following and it worked. Epic! :D

sudo apt-get install php libapache2-mod-php
sudo service apache2 restart