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


環境

系統環境: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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM