How to remove application in ufw app list Available applications?

I want to remove Apache, Apache Full, Apache Secure in this list. I have Nginx server. But, when I install phpmyadmin on nginx server, I had a problem. After that I saw Apache, Apache Full, Apache Secure in Available applications list.

$ sudo ufw app list

Available applications:
  Apache
  Apache Full
  Apache Secure
  Nginx Full
  Nginx HTTP
  Nginx HTTPS
  OpenSSH

I've tried:

sudo service apache stop
sudo apt-get remove apache
sudo apt-get uninstall apache
sudo apt remove apache --purge
sudo apt-get remove apache
sudo apt-get purge apache

But not works. How to remove this three applications?


Solution 1:

From the article Firewall of Ubuntu documentation:

Applications that open ports can include an ufw profile, which details the ports needed for the application to function properly. The profiles are kept in /etc/ufw/applications.d, and can be edited if the default ports have been changed.

I do not think the presence of these application profiles could be a problem in any way, but you can remove UFW's Apache profile by the command:

sudo rm -R /etc/ufw/applications.d/apache2*

To find which service is using HTTP|HTTPS ports 80|443 use this command:

sudo lsof -i -n -P +c 0 | grep ':80\|:443'

I don't know which version of Ubuntu is, but in 99% to remove Apache2 completely you should use:

sudo apt update
sudo apt remove --purge apache2*
sudo apt-get autoremove && sudo apt autoclean