Last updated on June 25th, 2024 at 09:11 am
Apache is a popular web server used by millions of websites and blogs. Almost every web administrator wants to be able to monitor the status of their Apache server. While there are many paid and free tools available for this purpose, they often overlook Apache’s very own web-based dashboard. Apache server status dashboard allows you to monitor key server metrics such as incoming requests & server load that help you monitor server health regularly. However, by default, it is not enabled. 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
Depending on your Linux system, follow the steps mentioned below.
Ubuntu/Debian
It is very easy to enable mod_status on Ubuntu/Debian systems. Just run the following command.
sudo a2enmod status
RHEL/Fedora/CentOS
On RHEL/Fedora/CentOS systems, you will need to modify Apache server configuration file.
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
First of all, take a backup of your file so that you can easily recover it in case something goes wrong. Open terminal and run the following command to backup your config file.
$ sudo cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/backup-httpd.conf
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
Save and close the file.
2. Configure mod_status
For Ubuntu/Debian: If you are using Ubuntu/Debian systems and have enabled mod_status using a2enmod command, then open Apache config file.
Look for the following block of code or search for location in Apache configuration file.
# 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. By default, you can access your Apache server’s dashboard at https://your_ip_or_domain/server-status. If you want to change the URL at which the dashboard is available, then change /server-status in location tag above as per your requirement.
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
By default, Apache server dashboard will help you track a bunch of useful metrics. However, if you want to monitor more information, then you can optionally enable extended status to track more metrics such as CPU Usage, Requests per second, total traffic, etc. To do this, look for the following line.
# ExtendedStatus On
and uncomment it by removing # in front of it.
ExtendedStatus On
4. Restart Apache Web Server
Restart Apache web server to apply changes.
# service httpd restart OR # systemctl restart httpd OR # sudo service apache2 restart
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.
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. Please note, once you enable Apache server dashboard, then its URL is publicly available. If you do not want every one to see this dashboard then either do not share its URL with others and do not link to this URL from any of your web pages otherwise it will be discovered by search engines. Also, you may want to add a basic authentication in Apache for this URL so that only authorized people can access it.
Conclusion
In this article, we have learnt how to enable Apache server status dashboard. It helps all server administrators keep track of their Apache servers by easily monitoring its key metrics on a web browser. Also, it plays well with other server management tools, and free of cost. So even if you already use a server monitoring tool, there is no harm in checking it out. But once it is enabled, it is important to ensure that it is not accessible by unauthorized users, just for security purposes.
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!
Also Read :
How to Remove X-Powered-By in Apache/PHP
How to Disable HTTP OPTIONS in Apache
How to Set Default Charset to UTF8 Encoding in Apache
How to Enable mod_rewrite in XAMPP, WAMP
How to Change Default Index Page in Apache
Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI & software development.