Ready to know about downtime before your customers?
Status List delivers uptime monitoring and professional hosted status pages for sites of all shapes and sizes.
Trusted by 1000+ companies
The Apache Status page (mod_status) is a built-in feature that displays real-time information about Apache’s performance, including the number of requests being processed, active connections, and server uptime. This page is an excellent tool for monitoring server performance and identifying issues.
To access the Apache Server Status page, you need to enable it in the Apache configuration file, usually located in httpd.conf
. Once enabled, you can view the status page by navigating to http://yourserver.com/server-status
. Remember to replace yourserver.com
with your server’s actual domain name.
Add the following configuration block to your httpd.conf
file:
<Location "/server-status">
SetHandler server-status
</Location>
You can modify the /server-status
value if you would like to us a different route (e.g. /status/apache
).
Before we turn on our status page, we need to secure it from the outside world. We don’t want attackers or customers seeing our internal server information. To secure our status page, we can use the Allow from
directive. In the example below, we only allow clients on local networks to access our status page.
<Location "/server-status">
SetHandler server-status
Order deny,allow
Allow from 10.0.0.0/8 127.0.0.1
</Location>
The Allow from
line ensures that no one outside of your local network is able to access your status page. You may want to include your public ip address here as well.
Trusted by 1000+ companies
Now that your status page config is ready and secured, let’s publish it. Before we apply the configuration, let’s test your configuration changes for syntax errors. Run the following command to test your config:
httpd -t
Fix any issues that are reported before continuing.
Once your configuration is ready, restart your Apache service to apply your configuration:
service httpd restart
To access the status page, open your browser and go to http://yourserver.com/server-status
. You should get a page that looks like this:
There are a few sections to the browser-based status page. There’s a section with aggregate stats, a section of active requests and some TLS details at the bottom. Let’s dig into each section on it’s own.
The top section of the status page has a bunch of aggregated stats. These show how Apache is performing over the long haul. This section answers questions like: Does it typically use a lot of CPU? Are there a lot of client requests coming through?
Let’s look at each parameter
The Apache web server scoreboard is a really cool feature that shows what Apache has been up to in the last few seconds. It is so cool, we actually wrote an entire article about it: Apache Status Scoreboard Explained
The active workers section shows what the workers are currently doing. This is a very useful tool for debugging server load and problem areas. Here’s what the section could look like:
Let’s breakdown what Apache is showing us here:
ps -aux
outputTrusted by 1000+ companies
You may find that your status page won’t show and you get a 404 page for your main website instead. This may be because your .htaccess file is rewriting the URL. We can fix this by telling Apache not to rewrite our /server-status
route. Here’s how you can do this.
Locate your .htaccess
file and add RewriteCond %{REQUEST_URI} !=/server-status
before each RewriteRule
. Here’s an example of a WordPress .htaccess.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/wp-admin/
RewriteCond %{REQUEST_URI} !=/server-status
RewriteRule ^(.*)$ index.php/$1 [NC,L]
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/server-status
RewriteRule . /index.php [L]
</IfModule>
You may receive a 403 when trying to access the status page. This is because your apache permissions are incorrect, or you are trying to access the status page from an ip address that isn’t on the whitelist. You can fix this by checking your httpd.conf
Allow from
method. Ensure that your public IP is enabled. (You can find your public ip here).
<Location "/server-status">
SetHandler server-status
Order deny,allow
Allow from 10.0.0.0/8 127.0.0.1 <-- this line
</Location>
The built-in Apache status page is easy to setup and gives you a great diagnostic tool. Once you have this setup, your team will be able to diagnose and resolve issues is record time.
If you enjoyed this article, you may also enjoy Apache Command Line Status: How To Guide or Ultimate Apache Web Server Guide.
© Status List 2024