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. https://crt.sh/?q=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: mydomain.com
I ran this command: certbot run --non-interactive --nginx --agree-tos --no-redirect -m mymail@mydomain.com -d mydomain.com --http-01-port 8000 --https-port 8443
It produced this output:
My web server is (include version): nginx/1.19.4
The operating system my web server runs on is (include version): Alpine Linux v3.12
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.4.0
Hi all
I'm running Certbot+Nginx in a docker container as non root (port 8000/8443). External ports 80/443 are correctly forwarded and I'm abble to get a Let's encrypt certificate, no issue at this level.
My problem is to configure Nginx and mainly https section, when starting container, before the first certificate is generated: A certificate is required to enable https and to start Nginx, and Nginx is required to perform the Let’s Encrypt validation, and I would like Nginx to be automatically configured by Certbot, WITH ssl_dhparam and the include options-ssl-nginx.conf lines.
There are 2 sections iin my Nginx default.conf, one for port http port 8000, 1 for https 8443. I'll only detail https section, as there is no problem with http section.
What I tried:
- If I start with no ssl enable on port 8443:
server {
server_name mydomain.com;
listen 8443;
...
}
=> certbot error : a duplicate listen 0.0.0.0:8443
from log, it tries to add a second "listen 8443 ssl; # managed by Certbot" line
- If I start with a dummy initial certificate:
server {
server_name mydomain.com;
listen 8443 ssl;
ssl_certificate /etc/ssl/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
...
}
=> The dummy certificates lines are replaced by the Let'encrypt certificate, but without the ssl_dhparam and include options-ssl-nginx.conf lines:
server {
server_name mydomain.com;
listen 8443 ssl;
ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
...
}
The solution I found is to start with a dummy listen 8444 without ssl:
server {
server_name mydomain.com;
listen 8444 ;
...
}
=> Config is OK, WITH the ssl_dhparam and include options-ssl-nginx.conf lines , but I have to remove the dummy 8444 port and reload Nginx after Certbot reconfiguration:
server {
server_name mydomain.com;
listen 8444 ;
listen 8443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
...
}
My questions are:
- Is it a normal behavior at 1) that Cerbot tries to add a second "listen 8443 ssl; # managed by Certbot" line, instead of just adding "ssl" to the already existing "listen 8443;" line?
- Do you have a better solution than using a dummy "listen 8444", to force Nginx reconfiguration WITH ssl_dhparam/include options-ssl-nginx.conf lines ?
Thanks for help.