Certbot Standalone Mode

sudo certbot certonly --standalone --preferred-challenges http -d example.com

When you run this command, Certbot will start a temporary web server on port 80 (unless specified otherwise) and will respond to the HTTP-01 challenge from Let’s Encrypt. Once the challenge is successfully completed, Certbot will obtain the certificate and save it to a location on your system.

Note that since the command uses the --standalone option, you’ll need to make sure that port 80 is not in use by any other service at the time you run the command, and you’ll also need to manually configure your web server to use the obtained certificate once it’s issued.