Apache 2.4 mod_status configuration with virtual hosts Getting Forbidden error

apache, status, virtualhost

Solution

Change it to this:

<Location /server-status>
    SetHandler server-status
    Require ip 127.0.0.1
    Require ip ::1
    Require ip 81.133.136.16
</Location>

- Don't use require "host" if you don't need it because it will try to resolve it (especially for localhost)

- Check the error logs also.

- The ::1 is localhost for IPv6, you probably need it.

Problem

I am trying to get mod_status set up on my apache 2.4 server. I have trawled the net for hours but all the examples given just show the tags in the main httpd.conf file, not how to place the directives into a virtual host setup. This is my virtual host config with what I have tried. When I do this and then open a local browser or a browser from my allowed ip address (my remote public address) I get a forbidden error in the browser. ``` <VirtualHost *:80> ServerName www.thevmscloud.com ServerAlias thevmscloud.com ServerAdmin admin@thevmscloud.com DocumentRoot "d:/wamp/webdocs/www/" ErrorLog "logs/www.thevmscloud.com.log" CustomLog "logs/www.thevmscloud.com.log" common <Location /server-status> SetHandler server-status Order deny,allow Deny from all Require host 127.0.0.1 81.133.136.16 </Location> <Directory "d:/wamp/webdocs/www/"> LogLevel crit Options Indexes FollowSymLinks Includes ExecCGI AllowOverride all Order Allow,Deny Allow from all Require all granted </Directory> ``` I have tried all manner of different combinations of settings commented in/out, location block with the virtual host block, outside it, in the httpd.conf main body and still no joy. Trouble is, I just cant find an example of this setup anywhere. Some posts say 'you might want to add this to you virtual host config' but then dont show how. Does anybody have any idea how this is to be configured so I can browse to my domain.com/server-status and see the server stats as expected? Many thanks Mark

Original source