6
<Location /status>
    SetHandler server-status
    order deny,allow
    allow from all
</Location>

But when I visit http://ip:port/status,

a 404 Not Found is reported, why?

  • Just for the heck of it, create an index.html file in that directory and see what happens. – John Gardeniers Jul 19 '11 at 5:02
  • @John Gardeniers,MUST that directory exist in the first place? I followed your advice but don't get anything different... – linux Jul 19 '11 at 5:06
  • Obviously the directory must exist or you must always get a 404 for it because the server can't serve what isn't there. The reason I suggested creating the index file is because, depending on how your setup is configured, the lack of an index file may result in a 404 unless you specifically specify another file that does exist in your URL. – John Gardeniers Jul 19 '11 at 5:11
  • @John: For a server-status? I've never had to have a physical file on disk for server-status to work. – womble Jul 19 '11 at 5:34
  • 1
    @John Gardeniers,why is the file still required when it's handled by SetHandler server-status? – linux Jul 19 '11 at 5:35
12

This can also happen when you have a .htaccess file in the document root and that file contains a RewriteRule, as is common with CMS pretty URLs. The <Location> directives act first, but the handler is not called at this stage. So then the RewriteRule sets a handler, eg a PHP script, so SetHandler effectively does nothing.

If this is the case, find the RewriteRule that is causing the problem, and add before it:

RewriteCond %{REQUEST_URI} !=/server-status

(Apache 2.2.22)

Addendum: also note that you can get a 403 if the DocumentRoot is not readable by the apache process at all, again because the server-status handler doesn't have a chance to work.

Addendum 2: if the .htaccess for the Apache default site is frequently overwritten, and the /server-status URL is necessary for eg Munin to work, then creating a <VirtualHost 127.0.0.1:80> stanza including the server-status handler may be administratively simplest.

  • It worked on Apache/2.4.6 (CentOS7). – Ali Yousefi Sabzevar Nov 22 '16 at 9:45
  • It was the case on my Apache 2.4.10 on Debian too. THANKS! – lucaferrario Jun 2 '17 at 9:08
4

My guess would be that you didn't load the status module - Can you confirm it ?

  • This is the correct answer. Worked perfectly. Thanks. – Gabriel Rodriguez May 13 '16 at 21:25
3

Because you've misconfigured something. What do your logs say about the cause of the 404? My first guess would be that ip:port isn't a valid vhost (or at least not valid for the vhost you've put the <Location /status> in, anyway), and it's probably dropping back to the default vhost. The error logs will make mention of irrational paths you didn't configure if that's the case. Other error log messages will mean different things, which is why it's so important to check them.

  • The log also says File does not exist – linux Jul 19 '11 at 4:37
  • 1
    Of course it does, that's why you got a 404. But what else does it say? – womble Jul 19 '11 at 4:38
  • It doesn't say anything else. – linux Jul 19 '11 at 4:53
  • 2
    At the very least, it will tell you which file does not exist. – womble Jul 19 '11 at 5:33
0
  • you do not need to configure a directory or path or index file
  • are you trying a different port? you shouldn't be port 80

the docs are:

<Location /server-status>
SetHandler server-status
Order Deny,Allow
Deny from all
</Locaton>

your location differs, I would not think it should matter, but try your location as /server-status instead of just /status.

However - I think Spud is right. you have not loaded that module.

-sean

0

If you are using WampServer, as I am for development, make a note of the following:

  • The httpd-info.conf file located at wamp\bin\apache\apache[version]\conf\extra contains relevant <Location> configuration:

    <Location /server-status> SetHandler server-status #Require host .example.com #Require ip 127 </Location>

  • This file may or may not actually be included in your Apache configuration. Look for the following line in your httpd.conf file and make sure it is uncommented:

    Include conf/extra/httpd-info.conf

In my case, the main problem was the latter: the line was commented by default and thus httpd-info.conf wasn't even loading.

-1

If you are using mod_rewrite and vhost configuration you need to add a blank vhost entry at the top of the vhost configuration file e.g.

<VirtualHost *:80>
</VirtualHost>

Then you can access it via the server IP address e.g. ip_address/server-status

  • Won't you also need a SetHandler server-status in that vhost? – Ladadadada Oct 9 '13 at 12:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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