-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
SSL certificate problem in Laradock (or Workspace?) #3029
Comments
Solved it via set curl.cainfo in php.ini |
Can you detailed describe your solution please? |
@riddman, sorry for the late reply. I have changed to use Laravel Valet few months ago~ You need to generate root CA key file (Click here for how to generate), and use this CA key to generate SSL certs file for each project. Remember add root CA key file to I wrote a bash script named #!/bin/bash
NAME=$1
DOMAIN="$NAME.test"
cd ./nginx/ssl
mkdir $NAME
cd $NAME
# Create a config file
>$DOMAIN.cnf cat <<-EOF
[ req ]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
[ dn ]
C = DE
ST = State or Province Name
L = Locality Name
O = Organization Name
OU = Development
emailAddress = test@test.com
CN = $DOMAIN
[ project ]
nsCertType = server
basicConstraints = CA:FALSE
keyUsage = digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment
extendedKeyUsage = serverAuth
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
subjectAltName = @project_subject
[ project_subject ]
DNS.1 = $DOMAIN
DNS.2 = www.$DOMAIN
EOF
# Generate a private key
openssl genrsa -out $DOMAIN.key 2048
# Create a certificate-signing request
openssl req -new -key $DOMAIN.key -out $DOMAIN.csr -config $DOMAIN.cnf
# Create the signed certificate
openssl x509 -req -in $DOMAIN.csr -CA ../root.pem -CAkey ../root.key -CAcreateserial -out $DOMAIN.crt -days 825 -sha256 -extfile $DOMAIN.cnf -extensions project And you can run command You need update ###########################################################################
# Check PHP version:
###########################################################################
RUN set -xe; php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}."
###########################################################################
# Copy root CA file:
###########################################################################
COPY certs/root.pem /usr/local/share/ca-certificates/root.pem Uncomment |
I am develop Laravel with Mac mini (M1).
I already set up a single Docker environment for all projects (site A, site B, site C...), and generated SSL certs for each project.
So, I can use HTTPS to access these sites via browser. However, if I use PHP's CURL to call site B API in site A, it will failed, the following is the error message from CURL:
Although I can set
CURLOPT_SSL_VERIFYHOST
andCURLOPT_SSL_VERIFYPEER
tofalse
but I really 100% don't like this way...and I had tried to add below codes into
/nginx/Dockerfile
or/workspace/Dockerfile
files, both are not working for me.so how can I fix it? I don't know that which files that need to be shared. If you want more information, please feel free to let me know :)
.env
docker-compose.yml
The text was updated successfully, but these errors were encountered: