服务器之家:专注于服务器技术及软件下载分享
分类导航

云服务器|WEB服务器|FTP服务器|邮件服务器|虚拟主机|服务器安全|DNS服务器|服务器知识|Nginx|IIS|Tomcat|

服务器之家 - 服务器技术 - Nginx - CentOS 6.7下nginx SSL证书部署的方法

CentOS 6.7下nginx SSL证书部署的方法

2019-11-24 19:09LoyaChen Nginx

这篇文章主要介绍了在CentOS 6.7下nginx SSL证书部署的方法,文中介绍的非常详细,需要的朋友可以参考借鉴,下面来一起看看吧。

环境

系统环境: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

总结

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

原文链接:http://qingkang.me/nginx-ssl.html

延伸 · 阅读

精彩推荐