How to properly enable mod_status on an apache server?

33,459

Solution 1

Ok, first confirm that you have a LoadModule that looks similar to this:

LoadModule status_module modules/mod_status.so

If that isn't there, then you'll need to download and add it.

If it is there then try this:

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

See if you can then hit http://www.my-domain.com/server-status

If you can then switch it to:

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

Where 192.168.1.100 is your internal IP if accessing internally or your external IP. This will restrict it so not just anyone can access it. You can then add multiple Allow from for each IP / IP range that requires access.

Solution 2

Apache 2.4 do not appear to like a space in the Order directive.

Order Allow, Deny only works as

Order Allow,Deny

Solution 3

mod_status built into Apache web server to get server status from a web browser. With this module we can easily find out how well the server is performing. All reports are generated in a html format.

Step1. Check if status module is enabled or not apache2ctl -M or ls /etc/apache2/sites-enabled

Step2. If not enabled, enable it by the command,

sudo a2enmod status

step3. Configure access,

Open /etc/apache2/mods-enabled/status.conf and comment the lines,

        #<Location /server-status>
        #    SetHandler server-status
        #    Require local
        #Require ip 192.0.2.0/24
        #</Location>

And add the following line,

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

We can restrict the access of server status for particular IP’s in this configuration by editing , Allow from our_public_ipaddress instead of Allow from all

Save the status.conf file .

Step4. Restart apache by the command,

/etc/init.d/apache2 restart

Step5. Check the server status page in browser

http://server-ip/server-status

Hope this would be helpful.

Solution 4

I developed a javascript application to display data in graphs https://github.com/dioubernardo/apacheServerStatusCharts

Solution 5

In Mac OS X Yosemite I had to use this otherwise some endless loop was happening:

<IfModule mod_status.c>
   # Allow server status reports generated by mod_status,
   # with the URL of http://servername/server-status
   # Change the ".example.com" to match your domain to enable.
   #
   <Location /server-status>
     SetHandler server-status
     Order deny,allow
     Allow from all
   </Location>
</IfModule>

Taken from https://osiutino.wordpress.com/2014/06/12/install-apache-2-4-9-on-mac-osx-10-9-mavericks/

Share:
33,459
Admin
Author by

Admin

Updated on October 06, 2021

Comments

  • Admin
    Admin over 2 years

    I have been searching everywhere looking for how to properly enable mod_status and nothing has worked. My server is called "willserver.main.ca". I am running the server on a windows virtual machine. I tried adding this to HTTPD config file:

    <location /server-status>
    SetHandler server-status
    
    Order Deny,Allow
    Deny from all
    Allow from main.ca
    
    </location>
    

    Any tips or help? I don't know if I am supposed to uncomment something or if I am just trying the wrong syntax over and over

  • ZygD
    ZygD over 8 years
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
  • Stefan Lasiewski
    Stefan Lasiewski over 8 years
  • Basil Musa
    Basil Musa over 8 years
    @Welsh Three notes if you can update: 1. Order Allow,Deny should have no space between Allow and Deny. 2. If there are multiple virtual hosts, there should be a default virtual host configured without a ServerName set for mod_status to work properly. 3. Surround them with an <IfModule status_module>...</IfModule> to ease enabling and disabling the module