CentOS 7.2 下nginx SSL证书部署的方法(使用crt以及key 配置)

转自:https://www.jb51.net/article/107350.htm

 

环境

系统环境:CentOS6.7

nginx version: nginx/1.8.1

证书

?
1
2
3
# ls /opt/nginx/conf/ssl
qingkang.me.crt # 公钥
qingkang.me.key # 私钥

配置

?
1
vim nginx.conf

找到以下内容

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# HTTPS server
#
#server {
# listen  443 ssl;
# server_name localhost;
# ssl_certificate  cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
#  root html;
#  index index.html index.htm;
# }
#}

修改为:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
server {
   listen  443 ssl;
    server_name qingkang.me;
   ssl_certificate  ssl/qingkang.me.crt;
   ssl_certificate_key ssl/qingkang.me.key;
   ssl_session_cache shared:SSL:1m;
   ssl_session_timeout 5m;
   ssl_ciphers HIGH:!aNULL:!MD5;
   ssl_prefer_server_ciphers on;
   location / {
    root html;
    index index.html index.htm;
   }
  }

检查配置

?
1
/opt/nginx/sbin/nginx -t

重启Nginx生效

?
1
/opt/nginx/sbin/nginx -s reload

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对脚本之家的支持。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值