注:本配置nginx版本号在:1.15.0以上
一,上传证书
将申请好的ssl证书crt跟私钥key上传到nginx配置文件所在目录,(要是找不到可以看这篇文章的末尾:nginx.conf位置在文章末尾)
二,编辑nginx.conf
http {
server {
listen 443 ssl;
server_name *******;
ssl_certificate 1_****.cool_bundle.crt;
ssl_certificate_key 2_****.cool.key;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://localhost:4561/;
}
}
}
三,检查配置文件是否正确
/usr/sbin/nginx -t
出现如下描述表示正确:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
四,重启生效
nginx -s reload