I'm out of ideas and I need help please!
I create my SSL using Openssl with this:
openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout key.pem -out cert.pem -days 3650
The cert.pem looks like this:
-----BEGIN CERTIFICATE-----
cert
-----END CERTIFICATE-----
The key.pem looks like this:
-----BEGIN PRIVATE KEY-----
key
-----END PRIVATE KEY-----
In docker-compose I have the cert/key sent to etc/nginx/ssl/...
volumes:
- ./sites:/etc/nginx/conf.d
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./ssl/cert.pem:/etc/nginx/ssl/cert.pem
- ./ssl/key.pem:/etc/nginx/ssl/key.pem
In nginx I have it added like this:
listen 443 ssl;
server_name localhost;
ssl_certificate ssl/cert.pem;
ssl_certificate_key ssl/key.pem;
When I start up docker-compose, I get this error with nginx:
web_1 | 2018/08/17 16:38:47 [emerg] 1#1: PEM_read_bio_X509_AUX("/etc/nginx/ssl/cert.pem") failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: TRUSTED CERTIFICATE)
web_1 | nginx: [emerg] PEM_read_bio_X509_AUX("/etc/nginx/ssl/cert.pem") failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: TRUSTED CERTIFICATE)
I've been working on this for several days now and I'm not sure why I keep getting this error. I've tried making it crt/key instead of .pem and I get the same error. If I just remove ssl all together the server works fine, but I need SSL very badly. Pleeeaaase help!
BEGIN TRUSTED CERTIFICATE
instead ofBEGIN CERTIFICATE
and same for the end. The filename and extension are irelevant (you can name itfoobar.42
and it will work the same way) only the content of the file is important.