Linux Nagios failed to log in to internal server error (Fixed)


Today, after completing the installation of Nagios, I can’t log in, with the following error message
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.

So look at the first shutdown log file, the relevant error logs can be viewed in Apache

vi /var/log/httpd/error_log

or

vi /usr/localapache/logs/error_log

Log prompts are validation errors,

nagios could not open password file :/usr/local/nagios/etc/htpasswd

Unable to open the htpasswd file, go to the directory to check

cd /usr/local/nagios/etc/htpasswd

The original actual file is htpasswd.users, missing users
Finally, enter the Apache to modify the httpd.cof file. In the AuthenUserFile, you should fill in the following address

/usr/local/nagios/etc/htpasswd.users

Finally, restart Apache,Nagios, verify login, OK, a little thought, or as the old saying goes, be careful to make a million years ship!

In addition, several other troubleshooting methods that cannot be logged in are provided:
1.

htpasswd  -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

The default password file permissions generated under root are root, and be sure to change to user Nagios

chown -R nagios.nagios /usr/local/nagios/etc/htpasswd.users

2. Change the setting of selinux =disabled in the /etc/selinux/config file

3. Add the verified

after httpd.conf

#setting for nagios
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
<Directory "/usr/local/nagios/sbin">
     AuthType Basic
     Options ExecCGI
     AllowOverride None
     Order allow,deny
     Allow from all
     AuthName "Nagios Access"
     AuthUserFile /usr/local/nagios/etc/htpasswd             //File for authentication for this directory access
     Require valid-user
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
     AuthType Basic
     Options None
     AllowOverride None
        AuthName "Nagios Access"

         AuthUserFile /usr/local/nagios/etc/htpasswd             //File for authentication for this directory access

         Require valid-user
    
</Directory>

Alias /nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">

     AuthType Basic

     Options None

     AllowOverride None

     Order allow,deny

     Allow from all

     AuthName "nagios Access"

     AuthUserFile /usr/local/nagios/etc/htpasswd

     Require valid-user

</Directory>

Htpasswd useful htpasswd. Users,Apache default validation file is htpasswd.users, with other filenames need to be defined
5./usr/local/nagios/etc/cgi. The CFG whether the user to set the password in the account of the account

Read More: