在本地Laravel Homestead服务器上验证自签名证书

问题描述:

我遵循以下有关创建SSL证书的详细信息,因此我可以使用https通过Laravel的Homestead运行本地测试站点.

I followed the following details on creating an SSL certificate, so I can run local test sites via Laravel's Homestead, using https.

在homestead vm上添加https证书

一切正常,但是通过 https://查看测试域时,我在Chrome的地址栏上看到一个红叉.它说证书是不信任的,因为它是自签名的,并且未经第三方验证.

All is well but when viewing the test domain over https://, I get a red cross on Chrome's address bar. It says that the certificate is untrusted due to being self-signed and not verified by third-party.

有没有一种方法可以解决这个问题?这样我就可以让我的HTTPS本地域受到Chrome的信任,并可以像在线一样工作?

Is there a way that I can sort this out? So that I can get my HTTPS local domains to be trusted by Chrome and work as if online?

Chrome不再允许您导出证书.您需要使用其他支持此功能的浏览器(例如firefox),或者只需将生成的证书从您的宅基地机器复制到共享目录,即可在钥匙串中导入并信任它.

Chrome does not allow you to export the certificate anymore. You need to either use another browser that supports this feature (e.g. firefox) or just simply copy the generated certificate to the shared directory from your homestead machine, so then you can import and trust it in the keychain.

# where I share all homestead certs with the host machine
mkdir /home/vagrant/Code/.certs/

cp -vf /etc/nginx/ssl/homestead.app.cert /home/vagrant/Code/.certs

在本地主机上,打开证书文件并将其导入到系统钥匙串.导入后,将其打开并将其信任级别设置为始终信任" .

On your local host machine, open the certificate file and import it to the System keychain. Once imported, open it and set its trust level to "Always trust".

重新启动Chrome即可完成.

Restart Chrome and you're done.