这篇文章主要介绍了在 CentOS 6.7 下 nginx SSL 证书部署的方法,文中介绍的非常详细,需要的朋友可以参考借鉴,下面来一起看看吧。
Nginx 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本 0.1.0 发布于 2004 年 10 月 4 日。其将源代码以类 BSD 许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。
环境
系统环境:CentOS6.7
nginx version: nginx/1.8.1
证书
- # ls /opt/nginx/conf/ssl
- qingkang.me.crt # 公钥
- qingkang.me.key # 私钥
配置
- vim nginx.conf
找到以下内容
- # 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;
- # }
- #}
修改为:
- 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;
- }
- }
检查配置
- /opt/nginx/sbin/nginx -t
重启 Nginx 生效
- /opt/nginx/sbin/nginx -s reload
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对 PHPERZ 的支持。
来源: http://www.phperz.com/article/17/0319/326249.html