• nginx配置HTTPS


     转自

    http://blog.csdn.net/IRhythm/article/details/52370339

    转自

    https://www.liaoxuefeng.com/article/0014189023237367e8d42829de24b6eaf893ca47df4fb5e000

    生成自签名证书的脚本

    #!/bin/sh
    
    # create self-signed server certificate:
    
    read -p "Enter your domain [www.example.com]: " DOMAIN
    
    echo "Create server key..."
    
    openssl genrsa -des3 -out $DOMAIN.key 1024
    
    echo "Create server certificate signing request..."
    
    SUBJECT="/C=US/ST=Mars/L=iTranswarp/O=iTranswarp/OU=iTranswarp/CN=$DOMAIN"
    
    openssl req -new -subj $SUBJECT -key $DOMAIN.key -out $DOMAIN.csr
    
    echo "Remove password..."
    
    mv $DOMAIN.key $DOMAIN.origin.key
    openssl rsa -in $DOMAIN.origin.key -out $DOMAIN.key
    
    echo "Sign SSL certificate..."
    
    openssl x509 -req -days 3650 -in $DOMAIN.csr -signkey $DOMAIN.key -out $DOMAIN.crt
    
    echo "TODO:"
    echo "Copy $DOMAIN.crt to /etc/nginx/ssl/$DOMAIN.crt"
    echo "Copy $DOMAIN.key to /etc/nginx/ssl/$DOMAIN.key"
    echo "Add configuration in nginx:"
    echo "server {"
    echo "    ..."
    echo "    listen 443 ssl;"
    echo "    ssl_certificate     /etc/nginx/ssl/$DOMAIN.crt;"
    echo "    ssl_certificate_key /etc/nginx/ssl/$DOMAIN.key;"
    echo "}"
  • 相关阅读:
    Android 7.0 UICC 分析(二)
    Android 7.0 UICC 分析(一)
    痛风有治吗?
    <学习笔记> 数论
    <学习笔记> 高精度 +
    <学习笔记> 线段树
    <学习笔记?> 链表
    <学习笔记> 手打堆模板
    <学习笔记> 倍增 lca
    <学习笔记> 最小生成树 Kruskal
  • 原文地址:https://www.cnblogs.com/dongruiha/p/7420710.html
Copyright © 2020-2023  润新知