Commands & Configuration in Apache
From the Apache cheat sheet · Installation & Basic Commands · verified Jul 2026
Commands & Configuration
Service commands, config testing, and configuration file locations
bash
# Start / stop / restart
sudo systemctl start apache2
sudo systemctl restart apache2
sudo systemctl reload apache2 # Graceful reload (no downtime)
# Test configuration before applying
sudo apachectl configtest # Syntax OK or error details
# Check loaded modules
apachectl -M💡 Always run apachectl configtest before restarting — catches syntax errors without downtime
⚡ Use reload instead of restart for zero-downtime config changes in production
📌 Debian uses a2ensite/a2dissite; RHEL puts everything in /etc/httpd/conf.d/
🟢 apachectl -S shows which virtual hosts are active and what ports they listen on