Cybersecurity

Cyber Security



Cybersecurity is the practice of protecting systems, networks, and programs from digital attacks. These cyberattacks are usually aimed at accesing, changing, or destroying sensitive information; extorting money from users; or tnterrupting normal business processes.


Users must understand and comply with basic data security principles like choosing strong passwords, being wary of attachments in email, and backing up data.

http升级为https--SSL证书
前两天做一个小程序,因为要审核上线才发现微信规定的服务器请求接口是https的,于是乎就为服务器升级

1:购买SSL证书,可以直接到阿里云上买,因为我是阿里云服务器,所在是在阿里云上面买的免费版证书试试手
2:下载证书配置服务器

买了证书签发完后,可以根据阿里云的开发文档指导配置

 参考网址: https://help.aliyun.com/knowledge_detail/95505.html?spm=5176.2020520154.cas.9.1738U2tQU2tQb4

因为我的是Nginx服务器,我就简单说一下Nginx服务器的配置

在Nginx的安装目录下创建cert目录,并且将下载的全部文件拷贝到cert目录中。如果申请证书时是自己创建的CSR文件,请将对应的私钥文件放到cert目录下并且命名为a.key;

打开 Nginx 安装目录下 conf 目录中的 nginx.conf 文件

server {
 listen 443;
 server_name localhost;
 ssl on;
 root html;
 index index.html index.htm;
 ssl_certificate   cert/a.pem;
 ssl_certificate_key  cert/a.key;
 ssl_session_timeout 5m;
 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_prefer_server_ciphers on;
 location / {
     root html;
     index index.html index.htm;
 }

3:记得一定要重启nginx服务器。执行:# /usr/local/nginx/sbin/nginx -s reload  重启成功后你的网页就会变成https访问了。

 

4:但是会出现一个问题,就是用户直接属于域名的话,它还会是访问http,除非手动输入https,这个时候就要监听服务器的80端口,让它跳转到https,需要在nginx.conf 文件下加入以下代码:

server {

listen 80;
server_name localhost;

rewrite ^(.*)$ https://$host$1 permanent;

location / {

root html;

index index.html index.htm;

 }


}

不是加在443端口的server里面,而是有两个server。

这样再重启Nginx服务器,用户一输入域名就会访问到https了。

原文

Last update: 2020-04-24|Pageview:9
Research Blog: EC | EC_INFO | EC_WORK |


BypResearch