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

14,186

Solution 1

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

Solution 2

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!

Share:
14,186

Related videos on Youtube

edotan
Author by

edotan

Updated on September 18, 2022

Comments

  • edotan
    edotan over 1 year

    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.

    • 0xFF
      0xFF over 11 years
      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?
    • edotan
      edotan over 11 years
      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
    • 0xFF
      0xFF over 11 years
      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?
    • edotan
      edotan over 11 years
      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
    • 0xFF
      0xFF over 11 years
      Change Allow from localhost to Allow from 127.0.0.1, restart Apache and try again. It has worked on my test server.
  • Michael Hampton
    Michael Hampton over 10 years
    How new of Apache version? And how do you know that this isn't something peculiar to your distribution (which you forgot to mention)?
  • vqdave
    vqdave over 6 years
    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