Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 3 min read

How to Monitor Apache HTTP Server with Vigilmon

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.

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:

  1. Sign up at vigilmon.online
  2. Click Add Monitor β†’ HTTP(S)
  3. Enter: https://yourdomain.com
  4. Interval: 60 seconds
  5. Alert if: HTTP status != 200 or response time > 3000ms
  6. 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:

  1. In Vigilmon, click Add Monitor β†’ SSL Certificate
  2. Domain: yourdomain.com
  3. 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.

Start monitoring Apache for free at vigilmon.online

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.