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

I have a monit script that checks that nginx is up and running. One thing it does is checks for a file 'ping.txt'. I can view it in the browser, but what would cause the script to get a 301 redirect response back?

monit script snippet:

if failed port 80 protocol http and request '/ping.txt'

Here's what's in the nginx log: - - [29/Feb/2012:20:59:58 +0000] "GET /ping.txt HTTP/1.1" 301 185 "-" "monit/5.2.5"
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Are you actually able to browse to ping.txt on the localhost? Maybe you need to try the LAN IP.

You can use a shell browser such as lynx or links2 to test. From your comment I see you may have configured it as a virtualhost. You mayneede to access the webpage using the hostname or full url, i.e. http://www.example.org/ping.txt.

In your example you try to access hence your webserver returns a 301.

To change the host do something like:

check host host.example.com with address
if failed port 80 protocol http and request '/ping.txt'

Or leave out the address.

share|improve this answer
I'm able to browser to it using a domain hosted by the server. I don't have a browser on the server so not sure how exactly to check it on the server. –  99miles Mar 1 '12 at 0:26
See my updated answer. –  aseq Mar 1 '12 at 0:36
I can hit the page fine from a browser on another machine. But the point of the file is simply for this command to check if nginx is running. ping.txt is used for nothing else. So I am needing to make this command work: 'if failed port 80 protocol http and request '/ping.txt'' -- I'm not sure how to change the hostname in that command. –  99miles Mar 2 '12 at 2:26
See my answer again :-) –  aseq Mar 2 '12 at 3:05
Very strange, it continues to get a 301. –  99miles Mar 2 '12 at 3:19

Your Answer


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.