how to enable apache server status dashboard

How To Enable Apache Server Status Dashboard Page

Apache server status dashboard allows you to monitor key server metrics such as incoming requests & server load that help you monitor server health regularly. In this article we will look at how to enable Apache server status dashboard page using mod_status module.


What is mod_status?

mod_status is an Apache module that allows you to monitor server load and key parameters about incoming requests about your web server, using an HTML page, that you can view on a web browser. mod_status displays the following metrics and is disabled by default.

  • Total number of incoming requests
  • Total number of bytes and counts server
  • Server Uptime
  • Server Load
  • The CPU usage of Webserver
  • Total Traffic
  • Total number of idle workers
  • PIDs with the respective clients and many more.


How To Enable Apache Server Status Dashboard Page

Here are the steps to enable Apache Server status dashboard page.


1. Enable mod_status

Apache configuration file is located at one of the following locations, depending on your Linux distribution.

  • /etc/apache2/httpd.conf
  • /etc/apache2/apache2.conf
  • /etc/httpd/httpd.conf
  • /etc/httpd/conf/httpd.conf

Open terminal and run the following command to open Apache configuration page.

$ sudo vi /etc/httpd/conf/httpd.conf

Look for the following line

#LoadModule status_module modules/mod_status.so

Uncomment it by removing # at its beginning.

LoadModule status_module modules/mod_status.so

Also Read : How to Remove X-Powered-By in Apache/PHP


2. Configure mod_status

Look for the following block of code or search for location

# 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.
#
#<location server-status="">
#    SetHandler server-status
#    Order deny,allow
#    Deny from all
#    Allow from .example.com
#</location>

Uncomment the location block by removing # in front of its lines, and update the Allow, Order and Deny directives as shown below.

<Location /server-status>
   SetHandler server-status
   Order allow,deny
   Deny from all
   Allow from all
</Location>

Th above configuration works for default Apache configuration. If you want to change the URL at which the dashboard is available, then change /server-status in location tag as per your requirement.

Also read : How to Disable HTTP OPTIONS in Apache

Also, this configuration will not work for Virtual Hosts. If you have configurated Virtual Hosts, then you need to place this location block inside the VirtualHost block, as shown below.

<VirtualHost *:80>
   …
   <Location /server-status>
      SetHandler server-status
      Order allow,deny
      Deny from all
      Allow from example.com
   </Location>
  …
</VirtualHost>


3. Enable Extended Status

You can optionally enable extended status to track more metrics such as CPU Usage, Requests per second, total traffic, etc. by looking for the following line

# ExtendedStatus On

and uncommenting it by removing # in front of it.

ExtendedStatus On

Also read : How to Set Default Charset to UTF8 Encoding in Apache


4. Restart Apache Web Server

Restart Apache web server to apply changes.

# service httpd restart
OR 
# systemctl restart httpd
OR
# sudo service apache2 restart

Also read : How to Enable mod_rewrite in XAMPP, WAMP


5. Verify Server Status

Open web browser and visit /server-status page of your domain. If your domain is www.example.com, go to

http://www.example.com/server-status

You will see something like the following.

Also read : How to Change Default Index Page in Apache


6. Enable Auto Refresh

You can also enable auto refresh for your dashboard by passing ?refresh=N parameter in the URL, where N is the number of seconds after which your dashboard refreshes automatically.

Here’s an example of URL to refresh server status dashboard every 5 seconds.

http://www.example.com/server-status?refresh=5

Hopefully, this article will help you enable Apache server status dashboard for your web server.

Meanwhile, why don’t you check out Ubiq? Ubiq makes it easy to visualize data in minutes, and monitor in real-time dashboards. Try it Today!