美文网首页
无域名,为弹性公网IP申请SSL证书

无域名,为弹性公网IP申请SSL证书

作者: 给艺艺一个未来 | 来源:发表于2022-05-29 11:51 被阅读0次

    申请证书

    ZoreSSL 提供免费证书。

    输入您的域名或公网IP:


    ZoreSSL.png

    确认您要申请的证书:


    ZoreSSL.png

    ZoreSSL提供的免费证书仅有90天的有效期,过期需重新申请。

    笔者采用了 HTTP File 的验证方式:

    ZoreSSL.png
    选择 Download Auth File 并将 Auth File 存放在服务器的 /root/.well-known/pki-validation 下。
    令服务器上的 nginx 提供对 Auth File 的HTTP访问的响应:
            location /.well-known/pki-validation/ {
               root /root/;
            }
    

    nginx 重新加载配置:

    nginx -s reload
    

    回到 ZeroSSL 点击 Next Step 即可完成验证并获得证书。

    nginx 配置

    下载证书,并上传至服务器中,笔者将证书存放在了 /root/180.101.49.12/ 中。

    开始配置 nginx 的 https server:

        server {
            listen       443 ssl;
            server_name  localhost;
    
            ssl_certificate      /root/180.101.49.12/certificate.crt;
            ssl_certificate_key  /root/180.101.49.12/private.key;
            ssl_trusted_certificate /root/180.101.49.12/ca_bundle.crt; 
    
            location / {
                root   html;
                index  index.html index.htm;
            }
        }
    
    

    nginx 重新加载配置:

    nginx -s reload
    

    若您的 nginx 在 configure 中未开启 ssl 模块,则需要重新 configure 和 make 您的 nginx ,如下:

    ./auto/configure --with-http_ssl_module --with-openssl=/root/openssl-1.1.1o --without-http_gzip_module
    

    关于 OpenSSL library 的安装:从 openssl 中下载源码,编译安装

    tar -zxvf openssl-1.1.1o.tar.gz 
    cd openssl-1.1.1o
    ./config 
    make
    

    相关文章

      网友评论

          本文标题:无域名,为弹性公网IP申请SSL证书

          本文链接:https://www.haomeiwen.com/subject/egsgprtx.html