How to reinstall Apache2 on Ubuntu

First uninstall and completely delete apache2 settings. It is important to remember that virtual host settings will be lost, but nothing will occur with the server file folder ("/var/www/html" or "htdocs")…

sudo apt removes apache2 && sudo apt purge apache2

Now reinstall Apache2:

sudo apt install apache2
sudo s
ystemctl start apache2

It will start without errors, route accesses to the host folder but will not interpret PHP, right? For this to regularize, install apache lib for php:

sudo apt install libapache2-mod-phpX.XX considering XXX as being your version of PHP
do systemctl restart apache2

We're all set!