Update and upgrade the system:
sudo apt update && sudo apt upgrade -y
Install the Apache software:
sudo apt install apache2
Allow Apache in the firewall:
sudo ufw app list
sudo ufw allow Apache
Create a dedicated directory for the virtual host:
sudo mkdir -p /www
sudo mkdir -p /www/howto.cogip.be
sudo chmod -R 755 /www
Edit a new file with nano:
sudo nano /etc/apache2/sites-available/howto.cogip.be.conf
And paste these lines:
<VirtualHost *:80>
ServerName howto.cogip.be
DocumentRoot /www/howto.cogip.be
ErrorLog ${APACHE_LOG_DIR}/howto-cogip-be.error.log
CustomLog ${APACHE_LOG_DIR}/howto-cogip-be.access.log combined
</VirtualHost>
<Directory /www/howto.cogip.be>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Save and exit nano.
Enable the virtual host an disable the default Apache website:
sudo a2ensite howto.cogip.be.conf
sudo a2dissite 000-default.conf
Enable two additional modules required by Grav:
sudo a2enmod rewrite ssl
Restart apache2 service:
sudo systemctl restart apache2