nginx配置ssl证书实现https (只有https.key和https.crt文件时)

1、生成https.pem文件

openssl x509 -inform PEM -in https.crt > https.pem

2、下列不在你配置文件中的字段添加上。server_name 为你自己的域名.
https.pem path: /opt/app/nginx/ssl/https.pem
https.key path: /opt/app/nginx/ssl/https.key

    listen 443 ssl;
    server_name develop.aed.etcc.group;
    ssl_certificate ssl/https.pem;  # 指定证书的位置,绝对路径
    ssl_certificate_key ssl/https.key;  # 绝对路径,同上
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; #按照这个套件配置
    ssl_prefer_server_ciphers on;
    vhost_traffic_status_filter_by_set_key $uri uri::$server_name;

© 版权声明
THE END
喜欢就支持一下吧
点赞0赞赏
分享
评论 抢沙发