本文共 1711 字,大约阅读时间需要 5 分钟。
You’ve written an app that should use HTTPS, but it’s not working: you’re getting a warning when you try to access it using HTTPS, even though you created a local certificate.
您编写了应使用HTTPS的应用程序,但该应用程序无法正常工作:即使您创建了本地证书,当您尝试使用HTTPS访问该应用程序时也会收到警告。
That’s because by default the browser does not trust local certificates.
这是因为默认情况下,浏览器不信任本地证书。
We need to install it!
我们需要安装它!
I assume you use Chrome in this section
我假设您在本节中使用Chrome
Click the “Not Secure” box near the address bar, and a little panel should show up:
单击地址栏附近的“不安全”框,然后会出现一个小面板:
Click the Certificate
item in the box, and you should see another panel show up, with the certificate details:
单击框中的“ Certificate
项,您将看到另一个面板显示证书详细信息:
Now drag the certificate icon from there to the desktop, or any other folder you want. Literally drag and drop using the mouse.
现在,将证书图标从那里拖到桌面或您想要的任何其他文件夹。 使用鼠标从字面上拖放。
Once you do so, find the file in the Finder, and double-click it.
完成后,在Finder中找到文件,然后双击它。
You should see a prompt to install it:
您应该看到安装提示:
Where you see the Keychain:
option, instead of login
, choose System
:
在看到Keychain:
选项的地方,而不是login
,选择System
:
Press Add, now you should see the certificate in the System keychain, listed as localhost
:
按添加,现在您应该在系统钥匙串中看到证书,列为localhost
:
Now double-click that, and this window should show up:
现在,双击它,然后将显示此窗口:
Click the arrow near Trust, and you should see this window, make sure you change “When using this certificate” to “Always Trust”.
单击“ 信任”附近的箭头,您应该会看到此窗口,请确保将“使用此证书时”更改为“始终信任”。
That’s it! Now close the Keychain app (cmd-Q
) and try reloading your Chrome tab, it should work!
而已! 现在关闭“钥匙串”应用程序( cmd-Q
),然后尝试重新加载您的Chrome标签,它应该可以工作!
And it should now work across any browser you use.
现在,它应该可以在您使用的任何浏览器上运行。
翻译自:
转载地址:http://eamgb.baihongyu.com/