Internal server error

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Nagius
Posts: 7
Joined: Sat Oct 31, 2015 4:29 pm

Internal server error

Post by Nagius »

Hi,

I have a problem in my apache server when I try to open nagios. Apache works correctly. But when I put http://localhost/nagios the web give me this message [img] (image attached).

The configuration that I use is:

Code: Select all

nagios@nagios-VirtualBox:: ~~$ sudo su
root@nagios-VirtualBox:: /home/nagios#
root@nagios-VirtualBox: /home/nagios#sudo apt-get install wget build-essential apache2 php5-gd libgd2-xpm libgd2-xpm-dev libapache2-mod-php5
root@nagios-VirtualBox: /home/nagios #mkdir Nagios
root@nagios-VirtualBox: /home/nagios # cd /Nagios
root@nagios-VirtualBox: /home/nagios /Nagios#wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.4.tar.gz
root@nagios-VirtualBox: /home/nagios /Nagios #wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz
root@nagios-VirtualBox: /home/nagios /Nagios #useradd nagios –p nagios123
root@nagios-VirtualBox: /home/nagios /Nagios #groupadd nagios1
root@nagios-VirtualBox: /home/nagios /Nagios #usermod -a -G nagios1 nagios
root@nagios-VirtualBox: /home/nagios /Nagios #tar zxvf nagios-4.0.4.tar.gz
root@nagios-VirtualBox: /home/nagios /Nagios #tar zxvf nagios-plugins-2.0.tar.gz
root@nagios-VirtualBox: /home/nagios /Nagios # cd nagios-4.0.4
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4#./configure --with-nagios-group=nagios --with-command-group=nagios1 -–with-mail=/usr/bin/sendmail --with-httpd-conf=/etc/apache2/sites-enabled
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4# make all
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4# make install
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4# make install-init
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4# make install-config
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4# make install commandmode
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4#  make install-webconf
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4# make install-webconf
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4#  cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/ 
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4#  chown -R nagios:nagios1 /usr/local/nagios/libexec/eventhandlers
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4# /usr/local/nagios/bin/nagios –v /usr/local/nagios/etc/nagios.cfg 
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4#  /etc/init.d/nagios start
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4#  htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin
root@nagios-VirtualBox: /home/nagios /Nagios /Nagios-4.0.4#  cd  ..
root@nagios-VirtualBox: /home/nagios /Nagios #  cd  nagios-plugins-2.0 
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0# ./configure --with-nagios-user=nagios --with-nagios-group=nagios1 --with-httpd-conf=/etc/apache2/sites-enabled
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0# make 
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0# make install
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0#sysv-rc-conf –list Nagios
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0#sysv-rc-conf –list httpd
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0#sysv-rc-conf –level 35 nagios on
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0# sysv-rc-conf –level 35 httpd on
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0 ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0#iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0#apt-get install -y iptables-persistent
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0#a2enmod rewrite
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0#a2enmod cgi
root@nagios-VirtualBox: /home/nagios /Nagios /nagios-plugins-2.0#service apache2 restart
Can anybody help me?

Thanks
Attachments
Internal server error.JPG
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Internal server error

Post by Box293 »

It SELinux installed and enabled?

Code: Select all

getenforce
If it is, at least set it to permissive:

Code: Select all

sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
setenforce 0
Is this a fresh build or did it just start happening?

Run these commands

Code: Select all

tail /var/log/syslog -n 100 > /tmp/syslog_log.txt
tail /var/log/apache2/error.log -n 100 > /tmp/apache2_log.txt
Send us these files:
/tmp/syslog_log.txt
/tmp/apache2_log.txt
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Nagius
Posts: 7
Joined: Sat Oct 31, 2015 4:29 pm

Re: Internal server error

Post by Nagius »

Hi,

I do all the steps that you give me but the error persist.
apache2_log.txt
(9.37 KiB) Downloaded 301 times
syslog_log.txt
(10.83 KiB) Downloaded 317 times
Thanks
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Internal server error

Post by hsmith »

Box293 wrote: Is this a fresh build or did it just start happening?
Can you please elaborate on this?
Former Nagios Employee.
me.
Nagius
Posts: 7
Joined: Sat Oct 31, 2015 4:29 pm

Re: Internal server error

Post by Nagius »

I create the virtual machine and configure nagios on it last week, so its a fresh build. And it did occur when I finish configure nagios with te configuration that I post it and I tried to enter nagios via web.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Internal server error

Post by rkennedy »

Box293 wrote:It SELinux installed and enabled?

Code: Select all

getenforce
Can you post the result of this?
Former Nagios Employee
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Internal server error

Post by Box293 »

Also, what is the output of these commands:

Code: Select all

ls -al /usr/local/nagios/etc/
ls -al /etc/apache2/sites-enabled/
grep nag /etc/passwd
grep nag /etc/group
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Nagius
Posts: 7
Joined: Sat Oct 31, 2015 4:29 pm

Re: Internal server error

Post by Nagius »

Code: Select all

root@nagios-VirtualBox:/home/nagios# getenforce
Disabled
root@nagios-VirtualBox:/home/nagios# ls -al /usr/local/nagios/etc/
total 76
drwxrwxr-x 3 nagios nagios  4096 oct 31 21:41 .
drwxr-xr-x 9 root   root    4096 oct 31 21:44 ..
-rw-rw-r-- 1 nagios nagios 12015 oct 31 21:35 cgi.cfg
-rw-r--r-- 1 root   root      50 oct 31 21:41 httpasswd.users
-rw-rw-r-- 1 nagios nagios 44475 oct 31 21:35 nagios.cfg
drwxrwxr-x 2 nagios nagios  4096 oct 31 21:35 objects
-rw-rw---- 1 nagios nagios  1312 oct 31 21:35 resource.cfg
root@nagios-VirtualBox:/home/nagios# ls -al /etc/apache2/sites-enabled/
total 12
drwxr-xr-x 2 root root 4096 oct 31 21:35 .
drwxr-xr-x 8 root root 4096 oct 31 21:18 ..
lrwxrwxrwx 1 root root   35 oct 31 21:19 000-default.conf -> ../sites-available/000-default.conf
-rw-r--r-- 1 root root  982 oct 31 21:35 nagios.conf
root@nagios-VirtualBox:/home/nagios#
root@nagios-VirtualBox:/home/nagios# grep nag /etc/passwd
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
lightdm:x:112:118:Light Display Manager:/var/lib/lightdm:/bin/false
colord:x:113:121:colord colour management daemon,,,:/var/lib/colord:/bin/false
nagios:x:1000:1000:nagios,,,:/home/nagios:/bin/bash
root@nagios-VirtualBox:/home/nagios# grep nag /etc/group
adm:x:4:syslog,nagios
cdrom:x:24:nagios
sudo:x:27:nagios
dip:x:30:nagios
plugdev:x:46:nagios
lpadmin:x:108:nagios
nagios:x:1000:
sambashare:x:124:nagios
nagios1:x:1001:nagios
root@nagios-VirtualBox:/home/nagios#
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Internal server error

Post by Box293 »

I suspect the www-data user (apache) is not a member of the nagios group and hence is the cause of your issue. Try this command:

Code: Select all

usermod -a -G nagios www-data
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Nagius
Posts: 7
Joined: Sat Oct 31, 2015 4:29 pm

Re: Internal server error

Post by Nagius »

I put that command but the error persist :(
Attachments
internal error.JPG
Locked