2
  1. 获取脚本
git clone https://github.com/wsdo/local-https-cert.git
cd local-https-cert
  1. 生成本地的RootCA:
sh createRootCA.sh

20200627134114
20200627134446

1.输入一个秘密(随便输入,但是要记住)
2.输入刚才的秘密(和上面秘密要一致)
  1. 创建根证书
sh createCertificate.sh

20200627134535

  1. 让打开RootCA改成始终信任

点击

20200627133245

点击login 输入上面生成证书的秘密

20200627133233
20200627134735
20200627134805

nginx

# HTTPS server
server {
    listen 443 ssl;
    server_name shudong.wang;

    ssl_certificate ssl/www.server.crt;
    ssl_certificate_key ssl/www.server.key;

    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout 5m;

    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    location / {
        # try_files $uri $uri/ /index.html;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:8000/;
    }
}

西树先森
7.1k 声望926 粉丝

从事开发多年,前端、后端(go、Python、php)、服务架构都有涉猎,经历过大公司、创业公司,擅长前端及公司技术选型。