1

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.

6
  • Maybe there is something wrong with VirtualHosts' configuration. It's hard to say without looking at full dump of Apache configuration. Did you restart Apache? Is there anything in ErrorLog? – 0xFF Dec 27 '12 at 19:32
  • This is the error I get: [Thu Dec 27 20:05:17 2012] [error] [client 127.0.0.1] client denied by server configuration: /prod/html/server-status – edotan Dec 27 '12 at 20:06
  • here is my httpd.conf: – edotan Dec 27 '12 at 21:42
  • Try adding ServerAlias localhost to this VirtualHost declaration. Try lynx http://myserver.com/server-status. Try temporary disabling mod_rewrite. As @Epaphus suggested try moving server-status declaration outside VirtualHost. Do you have any other VirtualHosts configured? – 0xFF Dec 28 '12 at 6:04
  • I added ServerAlias localhost and disabled the mod_rewrite but still I get [error] [client 127.0.0.1] client denied by server configuration: /prod/html/server-status – edotan Dec 28 '12 at 18:42
2

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

3

Just in case this helps someone:

In newer versions of Apache there is a default server-status config setting in conf/extra/httpd-info.conf which will override any server-status settings in httpd.conf

That default config in conf/extra/httpd-info.conf is set to “Allow from .example.com” and will annihilate all fancy server-status changes you do in httpd.conf

So if you are facing permission issues make sure you are editing the proper file!

2
  • 1
    How new of Apache version? And how do you know that this isn't something peculiar to your distribution (which you forgot to mention)? – Michael Hampton Aug 27 '13 at 20:02
  • 1
    I've been searching all over for an answer but this was it. Thank you so much! It was being overridden by (for me, on Debian) /etc/apache2/mods-enabled/status.conf – vqdave Jan 9 '18 at 1:13
0

You might want to look at your /etc/hosts

127.0.0.1 localhost
0

In my case I checked the /etc/hosts and found out that I have 2 hostnames listed for localhost:

127.0.0.1       localhost.localdomain   localhost

It seems some weird behavior between apache and the resolver. If the first 127.0.0.1 entry is localhost.localdomain you should have it in apache config:

Allow from localhost.localdomain

then you can get the proper answer with both

curl localhost/server-status
curl localhost.localdomain/server-status
curl 127.0.0.1/server-status

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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