Apache Configuration Cheat Sheet

Test Apache configuration

# Check if the Apache configuration is valid
apachectl configtest

Reload Apache

# Reload Apache to apply changes without a full restart
systemctl reload apache2

Restart Apache

# Fully restart Apache service
systemctl restart apache2

Get a list of available modules

# List compiled-in modules
apache2 -l

# List all loaded modules
apachectl -M

Enable a website (site)

# Enable a specific site configuration
# Replace SITE with the name of the site configuration file
a2ensite SITE

Disable a website (site)

# Disable a specific site configuration
# Replace SITE with the name of the site configuration file
a2dissite SITE