Apache installation on Ubuntu Linux automatically installs mod_status also. mod_status can be used to view server activities and performance from a web interface. Here are quick steps to get started with mod_status.
-
First ensure if you have mod_status installed. Assuming you have apache2 installed run the following on command line.
$ apache2ctl -M | grep status status_module
Note that apache2ctl -M lists all apache loaded modules.
-
mod_status comes with a default config (
/etc/apache2/mods-available/status.conf
) which is only accessible from localhost. Here is how the config entry looks like:
... <Location /server-status> SetHandler server-status Require local #Require ip 192.0.2.0/24 </Location> ...
-
To setup mod_status remote access with basic http auth add the following apache config. Note that you will have to create /etc/auth-file and a user in it. You can follow steps mentioned in tutorial Apache – add basic auth to a location or directory.
<IfModule mod_status.c> <Location /my-server-status> SetHandler server-status AuthType Basic AuthName "Restricted Resource" AuthBasicProvider file AuthUserFile /etc/auth-file Require valid-user </Location> </IfModule>
-
In case you are using wordpress or similar such software where every request is routed to index.php using .htaccess, you can add the following config to .htaccess before RewriteRule entry
... RewriteCond %{REQUEST_URI} !^/my-server-status$ RewriteRule . /index.php [L]
-
Now restart apache and access the /my-server-status page. You should be able to see the server status page with all requests being handled by Apache at that time. Here is how it will look like: