Mamp 在修复这个错误方面做得并不好,他们需要在 SSL 证书中生成更多信息。要修复它,您需要创建一个 conf 文件并运行一些终端命令。这对我有用
首先:conf 文件 sample.local.conf
将 sammple.local 替换为您的本地站点 url
[ req ]
default_bits = 4096
distinguished_name = req_distinguished_name
req_extensions = req_ext
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = US
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = NEW YORK
localityName = Locality Name (eg, city)
localityName_default = NEW YORK
organizationName = Organization Name (eg, company)
organizationName_default = SAMPLE
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_max = 64
commonName_default = sample.local
[ req_ext ]
subjectAltName = @alt_names
[alt_names]
DNS.1 = sample.local
首先制作 .KEY
openssl genrsa -out sample.local.key 4096
制作.CSR
openssl req -new -sha256 \
-out sample.local.csr \
-key sample.local.key \
-config sample.local.conf
然后
openssl req -text -noout -in sample.local.csr
创建 .CRT
openssl x509 -req \
-days 3650 \
-in sample.local.csr \
-signkey sample.local.key \
-out sample.local.crt \
-extensions req_ext \
-extfile sample.local.conf
然后,在 mac 上,您可以在终端中运行以下命令,而不是通过钥匙串。
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain sample.local.crt