Apache web server monitoring dashboard showing uptime status and HTTP health check configuration
# website monitoring

Monitoring Apache Web Server Uptime

Apache HTTP Server remains one of the most widely deployed web servers in the world, powering millions of sites and applications. While Apache is reliable, it can still fail — processes crash, configuration errors prevent restarts, SSL certificates expire, and upstream applications become unavailable.

Effective Apache monitoring combines external HTTP checks with server-level health endpoints to give you complete visibility.

What Can Go Wrong with Apache

Understanding failure modes helps you monitor the right things:

  • Apache process crash — the httpd process exits unexpectedly
  • Configuration error after reload — a systemctl reload apache2 with a bad config causes Apache to fail to restart cleanly
  • SSL certificate expiry — Apache fails to serve HTTPS (or serves invalid cert warnings)
  • Upstream failure (mod_proxy) — Apache proxies to an upstream app that's down, returning 502 errors
  • Worker exhaustion — Apache runs out of worker threads/processes under high load
  • Disk full — Apache can't write logs or temporary files
  • Permission error — file permission change prevents Apache from serving files

External HTTP monitoring catches all of these. If Apache is down for any reason, HTTP checks fail.

Step 1: External HTTP Monitoring

Configure an external uptime monitor pointing at your domain:

Monitor: https://yourdomain.com
Method: GET
Expected status: 200
Check interval: 1 minute

This is the most important check. It validates DNS resolution, port accessibility, Apache running, SSL certificate validity, and application response in a single check.

For applications served by Apache, also monitor critical application endpoints — the homepage alone doesn't tell you if your application is working.

Use multi-location monitoring to check from multiple geographic regions, catching CDN issues and regional network problems that a single-location check would miss.

Step 2: Add a Health Check Location

Add a lightweight health endpoint to your Apache configuration:

# In your Apache virtualhost config
<Location "/health">
    SetHandler default-handler
    DirectoryIndex disabled
    Require all granted
    Header always set Content-Type "text/plain"
    # Returns 200 with "OK" body
</Location>

# Or create a static file
# /var/www/html/health returns "OK"

Alternatively, use a simple PHP or static file:

Alias /health /var/www/health/health.html
<Directory /var/www/health>
    Require all granted
</Directory>

Monitor https://yourdomain.com/health for a fast, lightweight availability check that's separate from your main application.

Step 3: Apache Status Module

Enable the Apache server status module for internal metrics:

# Enable mod_status
LoadModule status_module modules/mod_status.so

<Location "/server-status">
    SetHandler server-status
    Require host localhost
</Location>

The /server-status endpoint provides:

  • Total requests served
  • Active worker threads
  • Request rate
  • Current connections and their state

Access locally: curl http://localhost/server-status?auto

For external monitoring, this endpoint should be restricted to localhost (as shown above) — don't expose it publicly.

Step 4: SSL Certificate Monitoring

If Apache terminates SSL:

<VirtualHost *:443>
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/yourdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.com/privkey.pem
</VirtualHost>

An expired or missing certificate causes Apache to fail to serve HTTPS. Set up SSL certificate monitoring with alerts at 30 days before expiry.

Step 5: Systemd Restart Configuration

Configure Apache to automatically restart on failure:

# /etc/systemd/system/apache2.service.d/restart.conf
[Service]
Restart=on-failure
RestartSec=5s

This restarts Apache if it crashes. External monitoring detects if the restart loop is failing (Apache keeps crashing, causing repeated brief outages).

Apache Config Validation

Before any reload or restart, validate the configuration:

apache2ctl configtest
# OR
apachectl -t

Always run this before systemctl reload apache2 to catch syntax errors that would prevent Apache from starting.

Step 6: Log Monitoring

Apache log files are your first diagnostic resource:

/var/log/apache2/error.log   — Apache errors, SSL issues, upstream failures
/var/log/apache2/access.log  — All requests with status codes

When an uptime monitor fires, checking error logs around the incident start time reveals the cause. Set up log aggregation (ELK stack, Loki, Papertrail) so logs are searchable and retained.

Common Apache Failure Patterns

FailureExternal Monitor ShowsDiagnosis
Apache process crashConnection refused / timeoutCheck systemd status, error.log
Config error after reloadConnection refusedCheck apachectl configtest
SSL cert expiredSSL handshake errorCheck certificate expiry
Upstream app down (mod_proxy)502 Bad GatewayCheck upstream application
Worker exhaustionSlow responses or timeoutCheck server-status, increase MaxRequestWorkers
Disk full500 errors or timeoutCheck df -h

Alert Configuration

For production Apache servers, configure:

  • SMS + Slack — when HTTP check fails (immediate action required)
  • Email — when SSL certificate approaches expiry (30-day advance)
  • Email — when domain registration approaches expiry (60-day advance)

Use a 2-failure confirmation count to avoid false alarms from brief network blips between the monitoring server and yours. See downtime alert configuration for details.


Monitor your Apache web server with external HTTP and SSL monitoring at Domain Monitor.

More posts

What Is Generative AI? How It Works and What It Creates

Generative AI creates new content — text, images, code, and more. This guide explains how it works, what tools are available, and where it's genuinely useful versus overhyped.

Read more
What Is Cursor AI? The AI Code Editor Explained

Cursor AI is an AI-powered code editor built on VS Code. Learn what it does, how it works, and whether it's the right tool for your development workflow.

Read more
What Is Claude Opus? Anthropic's Most Powerful Model Explained

Claude Opus is Anthropic's most capable AI model, built for complex reasoning and demanding tasks. Learn what it does, how it compares, and when to use it.

Read more

Subscribe to our PRO plan.

Looking to monitor your website and domains? Join our platform and start today.