美文网首页
https小记

https小记

作者: Jack_Yin | 来源:发表于2018-03-12 10:28 被阅读0次

背景:现在不用https很难愉快的进行开发 ,微信全家桶发,react native等都需要我们接口为https.....接下分享下我的https历程。

这里我用的证书是阿里云的CA证书


1.下载证书
2.将证书发到服务器
3.修改nginx配置

server {  
    listen  80;
    server_name hello.yinjikai.top
      
    rewrite ^(.*)$  https://$host$1 permanent;  
}

server {
    listen 443 ssl;
    server_name hello.yinjikai.top;
    index index.html index.htm;
    access_log  /var/log/nginx/docs.log  main;
    ssl on;
    ssl_certificate /etc/ssl/docs.20150509.cn.crt;
    ssl_certificate_key  /etc/ssl/docs.20150509.cn.key;
    error_page 404 /404.html;
    location / {
        root /var/www/html/docs;
    }
}

4.重启nginx服务

  1. 站点前面出现了安全的小绿锁


    image.png

相关文章

网友评论

      本文标题:https小记

      本文链接:https://www.haomeiwen.com/subject/isepfftx.html