Configuring the status module (mod_status) for Apache monitoring
The Apache mod_status module enables users to view detailed performance metrics of the Apache web server.
You must enable and configure the mod_status correctly in the Apache configuration file to get performance metrics from Apache and view performance data in Site24x7.
If there is an issue in the configuration, you may get the following errors:
HTTP Error 403: Forbidden: This error typically means that the client doesn't have permission to access the requested resource on the server. HTTP Error 500: This generic error message indicates that there was a problem on the server while trying to fulfill a request. It typically suggests that there's an issue with the server's configuration or that a script or application running on the server encountered an error.
Perform the following steps in the Apache configuration file to enable and configure the status module and get performance metrics:
- Enable the mod_status.
Depending on your Linux distribution, the Apache configuration file will be located at one of the following locations:
/etc/apache2/httpd.conf (Ubuntu, Debian, openSUSE)
/etc/apache2/apache2.conf (Ubuntu, Debian, openSUSE)
/etc/httpd/httpd.conf (Red Hat)
/etc/httpd/conf/httpd.conf (CentOS, Fedora)
- To open the Apache configuration file, for instance etc/httpd/conf/httpd.conf file applicable for CentOS, open the terminal and run the following command:
$ sudo vi /etc/httpd/conf/httpd.conf
- In the same file, for example the /etc/httpd/conf/httpd.conf file, search for the following line:
#LoadModule status_module modules/mod_status.so
- Uncomment the line mentioned above by removing #:
LoadModule status_module modules/mod_status.so
- In the same Apache configuration file, configure mod_status.
- Search for the following code block:
# 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.
# SetHandler server-status
# Order deny,allow
# Deny from all
# Allow from .example.com
- Uncomment the location block by removing # in front of its lines, and update the Allow, Order, and Deny directives as shown below:
Deny from all
Allow from all
- To restrict access to authenticated users and to specific IP addresses, add the following configurations:
Require user <USER_NAME>
The above configuration is for the default Apache configuration. To change the URL at which the dashboard is accessible, you can modify the location tag in the above configuration. By making changes to the /server-status path, you can tailor it to your requirements.
This configuration does not work for virtual hosts. If you have virtual hosts configured, place the location block as shown below inside the VirtualHost block:
Deny from all
Allow from example.com
- To apply the changes, restart the Apache server using the below Linux command:
service apache restart
- To verify the accessibility of the apache2 stats page, execute the command below:
curl -I http://localhost:80/server-status?auto
HTTP/1.1 200 OK
Date: Fri, 21 Apr 2023 10:11:01 GMT
Server: Apache/2.4.52 (Ubuntu)
Content-Type: text/html; charset=ISO-8859-1
You can also manually verify it by entering the below URL in a web browser:
Note: The URL will differ based on what you have entered in the Apache configuration.
Inspect the credentials in the plugin .cfg file and ensure you have provided the correct username and password.