我正在尝试在我的网站中使用 SpeechRecognition/webkitSpeechRecognition,因此需要使用 https 在 django 中运行开发服务器。
我已采取以下步骤:
runserver_plus
从安装和配置django-extensions
将由此生成的证书添加到我在 ubuntu 中的 cas 中。
# run server python3 manage.py runserver_plus --cert-file certs/localhost --reloader-interval 2 0.0.0.0:8000
然后
# to copy certificates: sudo mkdir /usr/share/ca-certificates/extra sudo cp certs/localhost.crt /usr/share/ca-certificates/extra/localhost.crt sudo chmod -R 755 /usr/share/ca-certificates/extra/ sudo chmod 644 /usr/share/ca-certificates/extra/localhost.crt sudo dpkg-reconfigure ca-certificates sudo update-ca-certificates
然后我重新启动一切以确保更改已被计算,但该网站仍然不受信任
https://127.0.0.1:8000
并且https://localhost:8000
我究竟做错了什么?
笔记:
awk -v cmd='openssl x509 -noout -subject' '
/BEGIN/{close(cmd)};{print | cmd}' < /etc/ssl/certs/ca-certificates.crt
# gives:
...
subject=CN = localhost
subject=CN = *.localhost/CN=localhost, O = Dummy Certificate
这是我的 chrome 证书 invlaid 截图:
注意二:我在 Firefox 中也有同样的问题
注三:
我已Allow invalid certificates for resources loaded from localhost.
通过将以下内容复制到浏览器中并选择启用来启用:
chrome://flags/#allow-insecure-localhost