分布式nginx SSL证书部署的方法

环境

系统环境:CentOS7

nginx version: nginx/1.8.1

证书

www.scwdjk.com.crt
www.scwdjk.com.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;
# }
#}
修改为:

# HTTPS server
#
server {
    listen       443 ssl;
    server_name  localhost;
    ssl_certificate      /root/ssl/www.scwdjk.com.crt;
    ssl_certificate_key  /root/ssl/www.scwdjk.com.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

注意:如果是多台主备结构nginx,分别配置重启即可。

    原文作者:致学无忧
    原文地址: https://www.jianshu.com/p/64bf1d0262d6
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞