购买免费证书

路径: 菜单 => 产品与服务 => 安全 => 云安全 => SSL证书(应用安全)

创建证书

申请证书

下载证书

服务器类型选择下载

检查证书

上传证书至服务器

1
2
scp ./6291212_ogliu.com.pem root@***.***.***.***:/etc/nginx/cert
scp ./6291212_ogliu.com.key root@***.***.***.***:/etc/nginx/cert

Nginx 配置证书

ssl_certificatessl_certificate_key 对应证书

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
server {
listen 80;
server_name ogliu.com;

root /*/ogliu/;

location / {
index index.php index.html index.htm;
}
}

server {
listen 443 ssl;
server_name ogliu.com;

root /*/ogliu/;
index index.html index.htm;

ssl_certificate /etc/nginx/cert/*.ogliu.com.pem;
ssl_certificate_key /etc/nginx/cert/*.ogliu.com.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 / {
index index.php index.html index.htm;
}
}

Nginx 配置检测、重启

1
2
nginx -t
nginx -s reload