
Apache has a built-in web-based server status module called mod_status. Here’s how it works!
In Ubuntu / Debian, first enable the apache status module:
$ sudo a2enmod status
An existing config file is already in place for Debian and Ubuntu. Edit as follows:
$ sudo nano /etc/apache2/mods-available/status.conf
It looks like this:
<IfModule mod_status.c>
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the ".example.com" to allow
# access from other hosts.
#
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost ip6-localhost
# Allow from .example.com
</Location>
</IfModule>
Add ExtendedStatus On above the Location directive to give more details such as CPU load, number of requests, and other information.
<IfModule mod_status.c>
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the ".example.com" to allow
# access from other hosts.
#
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost ip6-localhost
# Allow from .example.com
</Location>
</IfModule>
Save changes, then restart apache.
View server status locally with links2:
$ links2 http://localhost/server-status
Add a refresh setting to the end to auto-refresh specified seconds:
$ links2 http://localhost/server-status?refresh=5
(If you make the page public, consider using apache auth, or restricting the ip for access.)
View an example server-status html page here (new window).
Cool!