I would like to point out that it is after installing and uninstalling ufw via SSH (apt-get) that I cannot access anything at all and the applications that are there are even inaccessible.
So, please, how to fix that problem and restore my Virtualmin without removing or reinstalling Virtualmin on my server ???
Virtualmin installs and configures firewalld for use with Virtualmin and all common hosting services. You don’t need ufw. (You can use it if you like, but if you do, you’ll need to disable firewalld and reconfigure fail2ban to work with ufw.)
You would need to open the ssh port using ufw with sudo ufw allow ssh
You’ll also need to allow all the other services and ports you want to be available. I’ll leave that as an exercise for the reader. Webmin/Virtualmin is port 10000.