Table of contents
Install
Install apache2 via APT
sudo apt install apache2
Manage Apache service
You can view status, start, stop and restart the service:
sudo service apache2 status
sudo service apache2 start
sudo service apache2 stop
sudo service apache2 restart
sudo service apache2 reload
Configure
Permissions
Change owner and group to www-data:
sudo chown -R www-data:www-data <dir>
Enable and disable sites
a2ensite <site>
a2dissite <site>
Test configuration files
You can test the configuration files with the following command:
sudo apachectl configtest
Common directories
Exact directories may differ.
Sites available
cd /etc/apache2/sites-available
Sites enabled
cd /etc/apache2/sites-enabled
Diagnostics
Apache information:
apachectl -S
Review the log files
sudo apachectl -S | grep -i log