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/grav.howto.ovh
sudo chmod -R 755 /www
Edit a new file with nano:
sudo nano /etc/apache2/sites-available/grav.howto.ovh.conf
And paste these lines:
<VirtualHost *:80>
ServerName grav.howto.ovh
DocumentRoot /www/grav.howto.ovh
<Directory /www/grav.howto.ovh>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/grav-howto-ovh.error.log
CustomLog ${APACHE_LOG_DIR}/grav-howto-ovh.access.log combined
</VirtualHost>
Save and exit nano.
Enable the virtual host an disable the default Apache website:
sudo a2ensite grav.howto.ovh.conf
sudo a2dissite 000-default.conf
Enable two additional modules required by Grav:
sudo a2enmod rewrite ssl
Restart apache2 service:
sudo systemctl restart apache2