Virtual Host preventing server-status directive

apache-2.4

In my Ubuntu 16.4 VM I've set up Apache 2.4 successfully and have several vhosts set up. I'm wanting to see server-status but my first vhost keeps preventing that.
I've read and re-read the Apache 2.4 docs on this. I've put the following in my /etc/apache2/apache.conf, then in /etc/apache2/mods-enabled/status.conf and finally in the /etc/apache2/sites-enabled/0firstvhost.conf

<Location "/server-status">
      SetHandler server-status
      Require ip 10.211.55.0/24
    </Location>

In reading many posts on this subject in the Apache docs and ServerFault, I've tried many variations that are applicable to Apache 2.4

I can verify mod_status is running by seeing it when running

sudo apachectl -M | grep status

Of course, I've checked the apachectl configtest each time and restarted the apache2 service to see if I can browse to 10.211.55.3/server-status but the Drupal PHP app keeps interfering. There is no .htaccess at the root of this vhost.

I have placed this directive within and without the directive.

I check a browser at the IP addy of the VM and also within the VM run

curl localhost/server-status
curl 10.211.55.3/server-status

The Drupal app gets read first. What to try next? thx, sam

Best Answer

Found this which suggested the .htaccess for the default site was preventing mod_status from working. Their solution didn't work for me, but since I'm working with virtual hosts anyway I could create a virtual host without an .htaccess. I added an arbitrary host in Debian's /etc/hosts file:

127.0.0.1  foo.org

Created an empty directory among my other virtual hosts and created a new site and enabled it.

<Directory /home/foo.org>
</Directory>
<Location /server-status>
    SetHandler server-status
    Require local
    Require ip 127.0.0.1
    Require ip ::1
</Location>

<VirtualHost *:80>
  ServerAdmin webmaster@mysite.org
  ServerName foo.org
</VirtualHost>

So on localhost I can see the data

curl foo.org/server-status
Related Topic