Docker CE cannot load certificate

Hello,

I am running an instance of seafile on my server. Today the server stopped working and I cannot reach the webinterface.

I do get the following error:
seafile | nginx: [emerg] cannot load certificate “/shared/ssl/mydomain.tld.crt”: PEM_read_bio_X509_AUX() failed (SSL: error:0909006C:PEM routines:get_name:no start line:Expecting: TRUSTED CERTIFICATE)

There seem to be a problem with the SSL cert. I tried the solution given here: Docker CE installation fails to renew certificate already but it does fail.

Does anyone know how to fix this?

Thanks in advance!

I ran into a similar problem today. This error is because there’s no certificate yet. What you have to do is modify the nginx configuration file to make it as “normal” using http on port 80. This allows Let’s Encrypt to access your server via port 80.

Now modify the docker container file and set: SEAFILE_SERVER_LETSENCRYPT=true, also change the port to 443. Restart the container. This should now have it create a valid certificate. Now modify the nginx configuration file to have it only run on port 443 (and 80 redirects).

Run
docker exec seafile nginx -s reload
to have the nginx configuration file reloaded. This should now make it work. Next time it should auto renew the certificate for you as it can now access your nginx server (it boots up because there’s a valid certificate), and it will get redirected properly when checking your domain on port 80.