Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx: [emerg] cannot load certificate "/etc/certs/"myapp.local".pem" #77

Open
d41sys opened this issue Jul 25, 2021 · 6 comments
Open

Comments

@d41sys
Copy link

d41sys commented Jul 25, 2021

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.

@urre
Copy link
Owner

urre commented Aug 2, 2021

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?

@urre urre closed this as completed Aug 2, 2021
@urre urre reopened this Aug 2, 2021
@d41sys
Copy link
Author

d41sys commented Aug 2, 2021

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.

@urre
Copy link
Owner

urre commented Aug 4, 2021

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 🗓

@d41sys
Copy link
Author

d41sys commented Aug 4, 2021

Yeah, that also is my output. In this terminal, I run command docker and meet VARIABLE issue. After resetting the terminal, mkcert still error.

@urre
Copy link
Owner

urre commented Aug 10, 2021

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?

@d41sys
Copy link
Author

d41sys commented Aug 11, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants