DEV Community

Fega Suseno
Fega Suseno

Posted on • Edited on

Activating Module Status on Apache2

In this post, we will discuss mod_status in Apache2. This module provides detailed status information about the running Apache web server. It allows us to view runtime statistics, such as resource usage, the number of requests being processed, and various metrics related to server performance and status.

Let’s dive straight into the configuration. For this lab, I used Ubuntu 24.04 LTS. Let's get started!

To activate mod_status, use the following command:

a2enmod status
Enter fullscreen mode Exit fullscreen mode

Alternatively, you can manually enable it by creating a symlink from mods-available to mods-enabled. This method has been discussed in this post

Once activated, edit the status.conf file in mods-enabled

nano /etc/apache2/mods-available/status.conf
Enter fullscreen mode Exit fullscreen mode

Modify its contents as follows

<IfModule mod_status.c>
        <Location /server-status>
                SetHandler server-status
+               Require all granted
                #Require ip 10.0.0.0/21
        </Location>

        # Keep track of extended status information for each requ>
        ExtendedStatus On

        <IfModule mod_proxy.c>
                # Show Proxy LoadBalancer status in mod_status
                ProxyStatus On
        </IfModule>
</IfModule>
Enter fullscreen mode Exit fullscreen mode

The line highlighted in green is the one to pay attention to. By default, it is set to Require local. You can specify an IP address or subnet to allow specific access, use all granted to permit access to everyone, or comment it out with # to achieve the same effect.

Next, verify if the configuration is correct

apachectl configtest
Enter fullscreen mode Exit fullscreen mode

Then reload or restart Apache

systemctl reload apache2
systemctl restart apache2
Enter fullscreen mode Exit fullscreen mode

If you have a firewall enabled, open access on HTTP and HTTPS ports

ufw allow http
ufw allow https
Enter fullscreen mode Exit fullscreen mode

Test the configuration by accessing the Apache web server's IP address

http://ip-server/server-status
If it still doesn’t work, check the logs for further troubleshooting

tail -f /var/log/apache2/error.log
Enter fullscreen mode Exit fullscreen mode

If you’re still unable to access the status page, ensure that the mod_proxy module is enabled by running

Good luck! I hope you find this useful

Top comments (0)