nginx: [emerg] cannot load certificate "/etc/certs/"myapp.local".pem"
I just create certs by ./create_cert.sh but it requires mkcert. So, I use brew install mkcert and create the certs folder successfully. And this forwards to the problem VARIABLE is not set. After resetting the terminal, I meet this issue.
$ docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------------------------------------------------------------------------------------------
6137b00f87eb_myapp-mysql docker-entrypoint.sh --low ... Up 0.0.0.0:3306->3306/tcp,:::3306->3306/tcp
6cc6aea5d1cd_myapp-composer /docker-entrypoint.sh composer Exit 0
a290743c1e84_myapp-mailhog MailHog Up 0.0.0.0:1025->1025/tcp,:::1025->1025/tcp,
0.0.0.0:8025->8025/tcp,:::8025->8025/tcp
myapp-nginx /docker-entrypoint.sh ngin ... Restarting
myapp-phpmyadmin /docker-entrypoint.sh apac ... Up 0.0.0.0:8082->80/tcp,:::8082->80/tcp
myapp-wordpress docker-php-entrypoint php-fpm Up 9000/tcp
$ docker-compose logs nginx
myapp-nginx | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
myapp-nginx | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
myapp-nginx | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
myapp-nginx | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
myapp-nginx | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
myapp-nginx | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
myapp-nginx | 20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/default.conf.conf to /etc/nginx/conf.d/default.conf
myapp-nginx | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
myapp-nginx | /docker-entrypoint.sh: Configuration complete; ready for start up
myapp-nginx | 2021/07/25 06:06:04 [emerg] 1#1: cannot load certificate "/etc/certs/"myapp.local".pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/certs/"myapp.local".pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
myapp-nginx | nginx: [emerg] cannot load certificate "/etc/certs/"myapp.local".pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/certs/"myapp.local".pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
Please help me. Thank you.
Hey! Yes, mkcert is needed, I have it described on the readme instructions.
Can you test following the instructions under Option 1). Use HTTPS with a custom domain in the readme again?
Thank you. I believe I do all steps. But when run create_cert.sh terminal needs mkcert and I already install it. But this forward to VARIABLE problem.
What is your output when running create-cert.shย script?
The output when running the cert script should be like this: (I have mkcert installed also)
The local CA is already installed in the system trust store! ๐
The local CA is already installed in the Firefox trust store! ๐
The local CA is already installed in Java's trust store! ๐
Created a new certificate valid for the following names ๐
- "myapp.local"
The certificate is at "./myapp.local.pem" and the key at "./myapp.local-key.pem" โ
It will expire on 4 November 2023 ๐
Yeah, that also is my output. In this terminal, I run command docker and meet VARIABLE issue. After resetting the terminal, mkcert still error.
Ok, so mkcert works.
Now you should visit https://myapp.localย in the browser and get a HTTS lock symbol. Does it work?
What do you mean with resetting the terminal?
When mkcert works, I need to run the command docker-compose up again. That action forwards me to issue.
Resetting the terminal is just close and then open again.