Centos – error messages when enabling /server-status on Centos with Apache version httpd-2.2.3-31

apache-2.2centoshttpd

I enabled the following on httpd.conf:

ExtendedStatus On

LoadModule status_module modules/mod_status.so

and also:


NameVirtualHost *:80

<VirtualHost *:80>
  ServerName myserver.com
  ServerAlias myserver.com 

  DocumentRoot /prod/html

  RewriteEngine on
  RewriteCond %{HTTP_HOST} .*myserver.com$
  RewriteRule /(.*) http://myserver.com/$1 [R,L]





**<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost
</Location>**

</VirtualHost>

when running lynx http://localhost/server-status get the following message:
You don't have permission to access /server-status on this server.

I don't see anything related to /server-status in my /etc/httpd folder
these are the folders I have under /etc/httpd:

**conf
conf.d
logs -> ../../var/log/httpd
modules -> ../../usr/lib/httpd/modules
run -> ../../var/run**

any idea why I get the "permission denied" error?
do I need to install another package for get it?
Thanks!!
Dotan.

Best Answer

Try it with the IP instead of the host name, This is how mine looks ( ::1 is there as the server also has IPv6 enabled)

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1 ::1
</Location>

Using

lynx http://localhost/server-status 

might not be matching the virtual host "myserver.com" so you could try putting the Location /server-status outside of the VirtualHost in the http.conf