Sometimes it can happen that you have not configured your firewall correctly and locked yourself out so that the server is no longer accessible. Activate rescue CD and restart server with Linux 64 bit.
mount /dev/md2 /media/mydrive
Now you can access config files in your main operating system.
UFW configs you can find in Ubuntu
So you can reach it in this way.
Then you can add rules with your own IP and restart the server…
Or you can disable UFW with