如何给本地虚拟域名添加https证书

发布时间:2021-02-08 23:38:48 阅读:1503次

证书现在越来越火,如果网站不自带证书,都有不好意思

在之前,想给本地虚拟域名添加证书,如果单纯命令一行行来,还是非常麻烦的

今天告诉大家一个非常简单的方法

直接见代码


openssl req -x509 -out localhost.crt -keyout localhost.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=localhost' -extensions EXT -config <( \
   printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

我们可以将localhost改成自己的本地虚拟域名即可使用

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询

转载请注明:如何给本地虚拟域名添加https证书 出自老鄢博客 | 欢迎分享