Apache · Configuration and operations

How do you debug a failing Apache deployment?

MediumdebuggingtroubleshootingoperationsUpdated Oct 2026
Quiz this track

Short answer

Work from configuration to connectivity to application: validate config, inspect error logs, check listeners and virtual host mapping, then trace the request through rewrite and proxy layers with targeted logging.

Most Apache incidents fall into a few buckets: a configuration error, a port or firewall problem, a virtual host mismatch, a TLS failure, a proxy or backend failure, or an application error surfaced through Apache. A disciplined sequence avoids random changes on a live server.

bash
apachectl configtest
apachectl -S
apachectl -M
ss -ltnp | grep -E ':(80|443)'
curl -v http://127.0.0.1/ -H 'Host: example.com'
tail -n 100 /var/log/apache2/error.log
apachectl -t -D DUMP_VHOSTS

Targeted escalation

  • Rewrite issue: set LogLevel alert rewrite:trace3 briefly and replay the exact URL
  • TLS issue: use openssl s_client -connect host:443 -servername host
  • Proxy issue: curl the backend directly from the Apache host and check ProxyTimeout
  • Permission issue: inspect the error log for AH00035 and verify directory execute permissions
  • Capacity issue: check mod_status scoreboard for busy workers and queueing
  • Intermittent issue: correlate access logs by request ID and compare timestamps

Change one thing at a time and record it. Debug logging is expensive and can expose request data, so lower the level back after the investigation. If a reload with a bad config is suspected, configtest shows the parse error; Apache usually keeps the old configuration running.

A 500 from Apache is not always an Apache bug. It often means the handler, PHP-FPM or proxied application failed; check the application log before rewriting server configuration.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1A virtual host is not matching. What do you check first?
  2. 2How do you debug a rewrite rule that is not firing?
  3. 3What does a 503 from a reverse proxy usually mean?
  4. 4How do you investigate intermittent 502 responses?

Say it in the interview

I debug in layers: configtest, virtual host map, listeners, a direct curl with the right Host header, then error logs. For rewrites I enable trace logging briefly and replay the exact request. For proxy failures I test the backend from the Apache host. I change one thing at a time and turn verbose logging back down afterward.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Apache mock interview and get scored feedback on depth, clarity and confidence.