Home EngineerEnable the Apache server status page

Enable the Apache server status page

by Quy Ta
1 minutes read

To allow prometheus apache exporter to collect metrics from Apache Server, it’s required to enable status_mod module. This article will focus in


# update the below file (for apache in ubuntu)
sudo nano /etc/apache2/mods-available/status.conf

The following contents are to be added in status.conf

<Location /server-status>
        SetHandler server-status
        Require all granted
</Location>

Then restart the Apache service

sudo systemctl restart apache2
sudo systemctl status apache2.service

Then visit the URL to confirm it’s exposed and working. In my case, the URL is http://qt:80/server-status

The server status for Apache Server

For Docker container, if you are running httpd image, reference here https://hub.docker.com/_/httpd. Then there are different steps to follow.

docker exec -it httpd bash
# install vim (if it's not there already)
apt update # no SUDO needed if it's the default httpd image
apt install vim
# edit the file
vi /usr/local/apache2/conf/httpd.conf

# Enable the line `Include conf/extra/httpd-info.conf`
Include conf/extra/httpd-info.conf

# after that, update conf/extra/httpd-info.conf
vi /usr/local/apache2/conf/extra/httpd-info.conf

<Location /server-status>
    SetHandler server-status
    Require all granted
    #Require host .example.com
    #Require ip 127
</Location>

# exit vim, and container, then restart the container
docker restart httpd

That is. Now you can use this endpoint for collecting metrics.

You may also like