How to Monitor Apache HTTP Server with Vigilmon
Apache HTTP Server is one of the oldest and most widely deployed web servers in the world. It powers countless PHP apps, WordPress installs, and enterprise web platforms. Whether you're running Apache as a standalone server or as a reverse proxy in front of Tomcat or PHP-FPM, monitoring it properly prevents silent failures.
This guide covers monitoring Apache with Vigilmon — from basic HTTP checks to SSL and server status monitoring.
Common Apache Failure Modes
Apache failures are often subtle:
- MaxRequestWorkers exceeded — Apache stops accepting new connections silently
- SSL certificate expiry — HTTPS traffic fails with browser warnings
- PHP-FPM disconnection — Apache returns 502 while appearing healthy itself
- Disk full — error logs fill the disk, Apache stops logging, then crashes
- mod_rewrite misconfiguration — specific routes 500 while others work fine
Step 1: Monitor the Main HTTP(S) Endpoint
Start with the simplest check:
- Sign up at vigilmon.online
- Click Add Monitor → HTTP(S)
- Enter:
https://yourdomain.com - Interval: 60 seconds
- Alert if: HTTP status != 200 or response time > 3000ms
- Alert channels: email + Slack
Vigilmon monitors from multiple global regions — this eliminates false alerts from single-region blips.
Step 2: Enable Apache's mod_status
Apache ships with a built-in status module. Enable it for internal health checks:
# In /etc/apache2/mods-enabled/status.conf or httpd.conf
<Location /server-status>
SetHandler server-status
Require ip 127.0.0.1
Require ip ::1
</Location>
ExtendedStatus On
Reload Apache: sudo systemctl reload apache2
Now http://localhost/server-status shows active connections, request rates, and worker status.
Step 3: Add a Lightweight Health Check
For Vigilmon to check Apache's health externally, add a simple health endpoint:
# In your VirtualHost config
<Location /health>
SetHandler default-handler
Require all granted
</Location>
Create the file:
echo 'ok' > /var/www/html/health
Now monitor https://yourdomain.com/health — if Apache is responding, this returns 200 instantly.
Step 4: Monitor SSL Certificate
If Apache terminates SSL (with mod_ssl), add an SSL certificate monitor:
- In Vigilmon, click Add Monitor → SSL Certificate
- Domain:
yourdomain.com - Alert threshold: < 14 days remaining
This catches both Let's Encrypt renewal failures and manually-managed certificate lapses.
Step 5: Monitor PHP-FPM Health (If Using Apache + PHP-FPM)
Modern Apache deployments use mod_proxy_fcgi to send PHP requests to PHP-FPM. If PHP-FPM crashes, Apache returns 502:
# Proxy PHP to FPM
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1
Add a PHP-specific health check endpoint:
<?php
// /var/www/html/health.php
header('Content-Type: application/json');
echo json_encode(['status' => 'ok', 'php' => phpversion()]);
Monitor https://yourdomain.com/health.php — if this 502s while /health (static) returns 200, you know PHP-FPM is the problem.
Step 6: Heartbeat Monitor for Apache Process
Create a cron job that verifies the Apache process and pings Vigilmon:
# /etc/cron.d/apache-heartbeat
*/2 * * * * www-data systemctl is-active --quiet apache2 && curl -sf https://hb.vigilmon.online/YOUR-HEARTBEAT-ID
If the cron job stops sending pings (Apache is dead or the server is down), Vigilmon alerts you.
Recommended Monitor Coverage
| Monitor | URL/Target | Alert |
|---|---|---|
| HTTP(S) main | https://yourdomain.com |
status != 200, latency > 3s |
| HTTP(S) health | https://yourdomain.com/health |
status != 200 |
| HTTP(S) PHP health | https://yourdomain.com/health.php |
status != 200 |
| SSL Certificate | yourdomain.com |
expires < 14 days |
| Heartbeat | Apache process cron | no ping > 3 min |
Conclusion
Apache is battle-hardened but not failure-proof. Vigilmon gives you real-time, multi-region visibility into your Apache deployment without any agent installation or complex configuration.
Top comments (0)