如何让我的 Edge 网络浏览器信任在 WSL 中运行的本地开发 Symfony 网站?
我正在使用 WSL 1(适用于 Linux 的 Windows 子系统)和 Ubuntu 18.04 LTS 在 Windows 10 上编写网站。我正在使用Symfony 本地 Web 服务器. 我想使用 https,在 URL 上测试网站https://本地主机:8000 但网络浏览器显示该网站不受信任。Edge(基于 Chromium)显示一个包含以下错误的网页:
Your connection isn't private
Attackers might be trying to steal your information from localhost
(for example, passwords, messages, or credit cards).
NET::ERR_CERT_AUTHORITY_INVALID
检查证书显示错误:此 CA 根证书不受信任,因为它不在受信任的根证书颁发机构存储中。
我该如何避免这些错误?
答案1
symfony
在 WSL 中安装命令时,指示说运行命令symfony server:ca:install
。这将在 Windows 10 中创建一些自签名证书文件, ~/.symfony/certs/
例如 Edge,需要使用以下步骤告知此证书。
Copy ~/.symfony/certs/rootCA.pem to your Windows 10 Documents directory.
In Windows 10, search for "mmc" and run the Microsoft Management Console command.
Select File > Add Snap-in "Certificates" for current user.
Expand "Certificates - Current User"
Expand Trusted Root Certification Authorities
Click Certificates folder
Select Action > All Tasks > Import...
In the File chooser popup, select file filter All Files (*.*) and choose rootCA.pem
You will be prompted with a security warning. Verify the cert listed is the self-signed cert and click yes
(You may need to restart your browser or computer.)
此答案改编自这里