以阿里云域名为例
购买证书
数字证书管理服务 / SSL 证书 / 免费证书--立即购买
//证书填写
填写证书
域名新增解析项
下载证书密钥文件
服务器配置
1、下载下来的证书解压,里面有两个文件一个是.key,另一个是.pem,把这两个文件传到服务器的一个目录中。
2、编辑nginx配置文件;
server {
listen 443 ssl;#端口
server_name xxxxxxxx.cn;#你的站点域名/ip
#配置密钥地址
ssl_certificate /secretKey/7904057xxxxxxxx.cn.pem;
ssl_certificate_key /secretKey/7904057xxxxxxxx.cn.key;
#密钥超时
ssl_session_timeout 5m;
#charset koi8-r;
access_log logs/access.log main;
location / {
root /home/www/xcx;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root /home/www/xcx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
3、重启Nginx;
https域名安全评估
评测地址:https://myssl.com/
评测正常结果