Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nagios admin web application gets "url not found" after successful login #548

Closed
ghost opened this issue Aug 2, 2017 · 4 comments
Closed
Assignees

Comments

@ghost
Copy link

ghost commented Aug 2, 2017

Cookbook version

7.2.7

Chef-client version

13.2.20

Platform Details

CentOS Linux release 7.3.1611 (Core)

Scenario:

Install nagios

Actual Result:

Web browser gets "url not found after successful login".

Not Found

The requested URL /< was not found on this server.
Apache Server at 172.16.129.26 Port 80

Problem: apache2 - php made a change.
You are now required to add an "AddHandler" for php to the virtual hosts file.
I got bit by this change in my own web apps that use PHP.

I had to add the following statement to the apache2 virtual hosts file for php version 7

    AddHandler php7-script php

For php version 5 you have to add this:

   AddHandler php5-script php

I modifed the /etc/apache2/sites-enabled/nagios3.conf file, added the AddHandler for php7 (see below) and then restarted apache2 and the problem is fixed.

<VirtualHost *:80>
  ServerAdmin     root@localhost
  ServerName      acme.nagios.com
  DocumentRoot    /usr/share/nagios3/htdocs
  CustomLog       /var/log/apache2/nagios_access.log combined
  ErrorLog        /var/log/apache2/nagios_error.log

  Alias /stylesheets /etc/nagios3/stylesheets
  Alias /nagios3/stylesheets /etc/nagios3/stylesheets
  ScriptAlias /cgi-bin/nagios3 /usr/lib/cgi-bin/nagios3
  ScriptAlias /cgi-bin/statusjson.cgi /usr/lib/cgi-bin/nagios3/statusjson.cgi
  Alias /nagios3 /usr/share/nagios3/htdocs
  AddHandler php7-script php

  <Directory "/usr/lib/cgi-bin/nagios3">
     Options ExecCGI
  </Directory>

  <Location />
    AuthName "Nagios Server"
    AuthType Basic
    AuthUserFile "/etc/nagios3/htpasswd.users"
    require valid-user
  </Location>

  SetEnv TZ "UTC"

</VirtualHost>

This is how I fixed it in my cookbooks

Added this statement to my virtual host erb files:

AddHandler php<%= @params[:php_version] %>-script php

Then my template does this:

php_version lazy { `php -v | awk -F'.' 'NR==1 { printf substr ($1, 5) }'` }

Example output:

# php -v | awk -F'.' 'NR==1 { printf substr ($1, 5) }'
7
@shoekstra shoekstra self-assigned this Sep 18, 2017
@shoekstra
Copy link
Contributor

This will need manual testing to verify/resolve as at the moment our tests pass when opening pages and passing username and password to curl.

@gforghetti, could you test again with the latest release in the supermarket (8.0.0) and let us know if this manual testing is needed or if this can be closed?

@ghost
Copy link
Author

ghost commented Sep 19, 2017

Fix is working. Thanks Stephen!

@ghost ghost closed this as completed Sep 19, 2017
@shoekstra
Copy link
Contributor

Great to hear!

@lock
Copy link

lock bot commented Sep 19, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 19, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant