Systematic error analysis Apache2
Datum
🔹 Troubleshooting
We proceeded step by step, as if we were investigating a crime scene 🕵️♂️:
- Check installation & basic status
dpkg -l | grep apache2 systemctl status apache2 apachectl configtest
→ Everything installed, config syntactically OK, but service inactive.
Check logs
journalctl -u apache2 -n 50 tail -n 50 /var/log/apache2/error.log
→ No entries → Indication of very early startup termination
Check modules
apachectl -M
→ Load all modules, no visible crash
→ Problem occurs after module load
Direct foreground test
sudo /usr/sbin/apachectl -e debug -DFOREGROUND
→ Start aborts after module load
→ No logs → Very typical for runtime dir / envvars problem
Minimal start isolated
sudo /usr/sbin/apache2 -X
→ Error message
${APACHE_RUN_DIR} is not defined→ Runtime directory / envvars
LDAP configuration analysis
grep -R “ldap” /etc/apache2
→ Active LDAP modules that did not have a server, possible second startup problem
Load envvars
source /etc/apache2/envvars /usr/sbin/apache2 -DFOREGROUND
→ Now running without errors → envvars problem confirmed
Deactivate LDAP modules
sudo a2dismod ldap authnz_ldap ldap_userdir vhost_ldap
→ System startup possible, no further crashes
Start Apache via systemd
sudo systemctl restart apache2 sudo systemctl status apache2
→ Stable service, port 80 occupied, everything running
🔹 Conclusion
Main problem: envvars / runtime directory not set → startup aborted
Secondary problem: LDAP modules active without LDAP → immediate crash
Symptomatic consequences: No logs, no port binding, exit code 1
Solution: Load envvars + deactivate LDAP modules → Apache runs stably again







