For system, network and cloud administrators
sudo /etc/init.d/apache2 status
If you’re seeing an “Active (running)“ message then it means that your Apache2 process is still running and we need to stop it.
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 status
Notice that now, the “Active” section says “inactive“.
sudo apt-get purge apache2* -y
sudo apt-get autoremove -y
whereis apache2
If the result/output of the command above is empty, then Apache2 has been successfully uninstalled from your Ubuntu 18.04 LTS.