Apache mod_status and page not found 404



Problem: Checking the apache server status with the command “apachectl status”, “service httpd fullstatus” or by viewing http://server/server-status I get the message: “The requested URL /server-status was not found on this server” or your alternative 404 page not found error.

Answer: Assuming you have the module loaded and set up per the documentation of mod_status, this is this most likely a VirtualHost problem.

If you use NameVirtualHost *:80 directive, or any *:port, to run multiple name based virtual hosts, this configuration does not allow server-status on any of the publicly accessible addresses. This is because the first Virtual Host in the directive is considered the “Default Virtual Host”, any unknown entries on the NameVirtualHost space – in this example anything accessing port 80 on any IP address, will default go to this virtual host and hence you will get a 404 page not found error. Furthermore you can not place the server-status configuration inside of a VirtualHost directive to be read from a full domain name.

Solution: There are two basic ways to solve this. The first is to make the server listen on an alternative port (such as port 8080). Adding “Listen 8080” to the configuration will allow you to access the server status from http://yourip:8080/server-status.

The second will allow the command ‘apachectl status’ or ‘service httpd fullstatus’ to work properly but it will not allow external access. If you switch each * to the actual IP address to work from, then accessing from localhost (127.0.0.1) will work. So, you would need to change:

1
2
NameVirtualHost *:80
<VirtualHost *:80>

to

1
2
NameVirtualHost 10.0.0.3:80
<VirtualHost 10.0.0.3:80>

And then restart your server.

By that way, unless you need it, make sure to turn ExtendedStatus Off. This directive collects a lot of data from the site visitors and can slow down a busy server.