Install Certbot
Install snapd.
Remove old version of certbot:
sudo apt-get remove certbot
# or
sudo dnf remove certbot
Install certbot:
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
Run it!
sudo certbot --nginx
Caution!
In case you have an IP access blocking config in nginx, you need to disable it, temporarily at least.
For example, imagine you have this nginx block for IP access blocking:
Then disable it like so: