Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Please help resolve the following problem.

I am checking HTTP using Nagios and faced with the following error:

check_http -H 192.0.0.1
HTTP CRITICAL: HTTP/1.1 500 Internal Server Error - 3471 bytes in 0.104 second response time |time=0.103675s;;;0.000000 size=3471B;;;0
Toggle HighlightingOpen in New WindowSelect All

I am trying to check if HTTP is available on my external server (192.0.0.1). On that server I have nginx as a reverse proxy and Apache. Default directory for nginx is /usr/share/nginx/www which has a site in it with permissions as user:user.

nginx is running under the www-data user. I have tried adding nagios user to the group of www-data with no effect. What causing this problem?

Thanks for assistance.

UPDATE

nginx does not write errors to the error_log but to the access_log:

172.0.0.1 - - [20/Jan/2012:09:27:23 +0000] "GET / HTTP/1.1" 500 3094 "-" "check_http/v1.4.14 (nagios-plugins 1.4.14)"

where 172.0.0.1 is the nagios server IP address.

UPDATE 2

nginx listen to the port 80:

andrew@office:~$ telnet 192.0.0.1 80
Trying 1.0.0.192...
Connected to 192.0.0.1.
Escape character is '^]'.

UPDATE 3

When I access 192.0.0.1 in the browser, I have the error 500 in the logs:

192.0.1.1 - - [20/Jan/2012:09:30:39 +0000] "GET / HTTP/1.1" 500 3094 "-" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7"
192.0.1.1 - - [20/Jan/2012:09:30:40 +0000] "GET / HTTP/1.1" 500 3094 "http://192.0.0.1/" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7"

where 192.0.1.1 is my WAN IP.

share|improve this question
    
TL;DR "I have an error, please fix it". What do you get if you run curl http://192.0.0.1/? What about trying telnet, have you looked in your NGINX log? Does the site work for other users/computers? –  sam Jan 20 '12 at 8:52
    
You said that nginx is acting as a reverse proxy for Apache. What do you see in Apache's error logs for this request? –  Ladadadada Jan 20 '12 at 9:53
    
I'm sorry, but you have not provided enough information I'm affraid. Error 500 can have many causes, and you need to leek deeper yourself. –  Lucas Kauffman Jan 20 '12 at 10:17

2 Answers 2

Nagios will do what every user does, it will try to access a certain page. If that page can not be served you get a 404 error or you get a 201 with the page. However you are getting a 500 error meaning an internal server error. So there is a bad configuration your Nginx server because it can not server the page when Nagios requests it. You are getting a Critical error from Nagios, meaning Nagios is working but it sees there is a problem with your webserver.

The problem lies within your Nginx server and not Nagios. I suggest reading the error logs from Nginx.

share|improve this answer
    
Thank you for your reply. I have updated my post. –  Andrew Jan 20 '12 at 9:36

Thanks everyone for looking on this. You helped to identify the problem. I have solved this issue by adding:

if ($REMOTE_ADDR = "nagio_server_ip") {
    rewrite .* http://www.example.com last;
}

to my default nginx host configuration (under the location / section).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.