Update and upgrade the system:
BASH
sudo apt update && sudo apt upgrade -y
Install the Apache software:
BASH
sudo apt install apache2
Allow Apache in the firewall:
BASH
sudo ufw app list
BASH
sudo ufw allow Apache
Virtual host
Create a dedicated directory for the virtual host:
BASH
sudo mkdir -p /www
BASH
sudo mkdir -p /www/howto.cogip.be
BASH
sudo chmod -R 755 /www
Edit a new file with nano:
BASH
sudo nano /etc/apache2/sites-available/howto.cogip.be.conf
And paste these lines:
APACHE
<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:
BASH
sudo a2ensite howto.cogip.be.conf
BASH
sudo a2dissite 000-default.conf
Enable two additional modules required by Grav:
BASH
sudo a2enmod rewrite ssl
Restart apache2 service:
BASH
sudo systemctl restart apache2