微信小程序开发(6) SSL证书及HTTPS服务器

来源:互联网 发布:海岛奇兵升船数据 编辑:程序博客网 时间:2024/06/04 19:15

1. 域名

在万网购买,略

 

2. 云服务器

阿里云购买,略

 

3. 安装lnmp

使用lnmp.org程序,略

 

4. 申请证书

阿里云-管理控制台-安全(云盾)-证书服务-购买证书
证书类型: 免费型DV SSL
选择品牌: Symantec

购买成功后,绑定域名,配置DNS解析记录生效

 

5. 配置HTTPS服务器

Nginx的安装目录下创建cert目录
下载证书,放到cert目录
修改nginx.conf文件,加入443端口及证书目录

复制代码
server    {        listen 80;        listen 443 ssl;        #listen [::]:80;        server_name cet.fangbei.org;        index index.html index.htm index.php default.html default.htm default.php;        root  /home/wwwroot/cet.fangbei.org;        include none.conf;        #error_page   404   /404.html;        include enable-php.conf;        ssl_certificate /usr/local/nginx/cert/214130435490250.pem;        ssl_certificate_key /usr/local/nginx/cert/214130435490250.key;        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$        {            expires      30d;        }        location ~ .*\.(js|css)?$        {            expires      12h;        }        location ~ /\.        {            deny all;        }        access_log off;    }
复制代码

重启lnmp即可。

 

6. 使用https访问网站

支持80端口和443访问

http://cet.fangbei.org/

https://cet.fangbei.org/

https访问时,可以看到证书

原创粉丝点击