
How to enable the Apache mod_status Page
Apache mod_status is an Apache module that allows you to see web server load and connections via an HTML interface that can be accessed in a web browser.
- Total number of incoming requests
- Total number of bytes and counts server
- The CPU usage of Webserver
- Server Load
- Server Uptime
- Total Traffic
- Total number of idle workers
- PIDs with the respective clients and many more.
How to Enable mod_status in Apache
By default, Apache comes with mod_status enabled. You can also enable it in the Apache configuration file:
[root@quickhostuk ~]# vim /etc/httpd/conf/httpd.conf
Look for the line with mod_status and ensure it is not commented out with a #. It should look like so:
LoadModule status_module modules/mod_status.so
Configure mod_status for a single website server
Now find the Location section and ensure it looks like the following:
<Location /server-status>
SetHandler server-status
Order allow,deny
Deny from all
Allow from all
</Location>
Configure mod_status for a multi website server
The above configuration is the default configuration for the default Apache website (single website). If you have one or more Virtual Hosts, the above configuration will not work. You will need to define the same configuration for each virtual host for any domains you want to be able to access mod_status:
<VirtualHost *:80>
ServerAdmin quickhostuk@example.com
DocumentRoot /var/www/html/example.com
ServerName example.com
ErrorLog logs/example.com-error_log
CustomLog logs/example.com-access_log common
<Location /server-status>
SetHandler server-status
Order allow,deny
Deny from all
Allow from example.com
</Location>
</VirtualHost>
Enable ExtendedStatus
You can use the ExtendedStatus setting in the httpd.conf file to add more information to the statistics such as CPU usage, requests per second, total traffic, etc.
Locate the ExtendedStatus variable and ensure it is uncommented and on:
ExtendedStatus On
Now restart Apache to apply the changes:
[root@quickhostuk ~]# service httpd restart
OR
[root@quickhostuk ~]# systemctl restart httpd
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
You can now access the Apache status page with /server-status
Web browser example:
- http://example.com/server-status
- http://1.2.3.4/server-status
Note: where 1.2.3.4 is the IP of your server.
Command-line example:
[root@quickhostuk ~]# lynx http://1.2.3.4/server-status
- OR -
[root@quickhostuk ~]# /etc/init.d/httpd fullstatus