Certbot setup for linux nginx

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: willemoudyk.com

I ran this command: sudo certbot certonly --nginx

It produced this output:

:~# sudo certbot certonly --nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated) (Enter 'c' to cancel): willemoudyk.com
Requesting a certificate for willemoudyk.com
Performing the following challenges:
http-01 challenge for willemoudyk.com
Waiting for verification...
Challenge failed for domain willemoudyk.com
http-01 challenge for willemoudyk.com
Cleaning up challenges
Some challenges have failed.

IMPORTANT NOTES:

My web server is (include version): nginx

The operating system my web server runs on is (include version): Linux willem 4.4.0-204-generic #236-Ubuntu SMP Fri Feb 19 16:11:27 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don't know): yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 1.13.0

Cloudflare thinks your webserver is down. Try visiting https://willemoudyk.com/.

If you want to be able to issue a certificate, you need to get your site working behind Cloudflare first.

I started the webserver and now I get this error:
Last login: Sat Mar 20 00:53:02 2021 from 203.206.182.159
root@willem:~# sudo certbot certonly --nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated) (Enter 'c' to cancel): willemoudyk.com
Requesting a certificate for willemoudyk.com
Performing the following challenges:
http-01 challenge for willemoudyk.com
Cleaning up challenges
Encountered exception during recovery: certbot.errors.MisconfigurationError: nginx restart failed:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
nginx restart failed:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

ps. I am using docker engine to build this machine .

pps. thanks heaps for trying to help me.

Is nginx running inside a container, or on the Docker host?

it is running inside the container

OK.

In that case, running Certbot in this way won't work. Certbot can't see or configure nginx from outside of the container.

There aren't really any one-size-fits all instructions for Docker + Let's Encrypt. Every Docker environment is slightly different.

I would suggest looking up some articles on how other people have configured Let's Encrypt certificates inside Docker containers. If you're following some instructions/setup guide already for this Docker-based application, it's possible that the authors have already written instructions to setup SSL.

Thanks heaps, I will follow your advise. Hopefully there are some good articles out there.

I think i have got it working. How do I double check that it's now okay ?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.