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.
Requesting a certificate for app.adfontesmedia.com
Encountered exception during recovery: certbot.errors.MisconfigurationError: nginx restart faile
d:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]: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 [::]: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 [::]: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 [::]: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 [::]: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 [::]: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 [::]: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 [::]: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 [::]: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 [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/
log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
My web server is (include version): nginx/1.20.0
The operating system my web server runs on is (include version): Amazon Linux 2
My hosting provider, if applicable, is: AWS EC2
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.19.0
Okay after you mentioned I checked again and somehow apache server was running and not the nginx. So I stopped apache and ran command sudo certbot --nginx and it produced following results.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): app.adfontesmedia.com
Requesting a certificate for app.adfontesmedia.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/app.adfontesmedia.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/app.adfontesmedia.com/privkey.pem
This certificate expires on 2021-12-08.
These files will be updated when the certificate renews.
Deploying certificate
Could not install certificate
NEXT STEPS:
The certificate was saved, but could not be installed (installer: nginx). After fixing the error shown below, try installing it ag
ain by running:
certbot install --cert-name app.adfontesmedia.com
The certificate will need to be renewed before it expires. Certbot can automatically renew the certificate in the background, but
you may need to take steps to enable that functionality. See User Guide — Certbot 2.7.0.dev0 documentation for instructions.
Could not automatically find a matching server block for app.adfontesmedia.com. Set the server_name directive to use the Nginx ins
taller.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or r
e-run Certbot with -v for more details.
I updated server_name for nginx.config listening on port 443 with app.adfontesmedia.com. Checked director for /etc/pki/nginx/ but No such file or directory.
ransudo certbot --nginx again. Got following output.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /etc/nginx/nginx.conf -t.
nginx: [emerg] cannot load certificate "/etc/pki/nginx/server.crt": BIO_new_file() failed (SSL: error:02001002:system library:fopen:
No such file or directory:fopen('/etc/pki/nginx/server.crt','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] cannot load certifica
te "/etc/pki/nginx/server.crt": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/e
tc/pki/nginx/server.crt','r') error:2006D080:BIO routines:BIO_new_file:no such file)\nnginx: configuration file /etc/nginx/nginx.
conf test failed\n')
While running sudo certbot install --cert-name app.adfontesmedia.com got following output.
Certbot can obtain and install HTTPS/TLS/SSL certificates. By default,
it will attempt to use a webserver both for obtaining and installing the
certificate.
certbot: error: unrecognized arguments: --cert-name app.adfontesmedia.com
I updated nginx.conf server with port 80 server_name to be app.adfontesmedia.com and ran sudo certbot --nginx again. It worked perfectly and now I have SSL on my domain. Thank you @rg305 for your help.
I kept server with port 443 to be commented before running command.