zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    ByteArrayInputStream(字节数组输入流) 示例
    ASP.NET 页面对象模型
    HTML常用标记
    [elementui]上线iconfont乱码
    time与timeEnd测试运行时间
    放大镜效果
    canvas
    [css] 样式列表
    千分符
    centos源失败
  • 原文地址:https://www.cnblogs.com/John-2011/p/12765438.html
Copyright © 2011-2022 走看看