ubuntu nginx 配置 https 证书

转载 https://blog.csdn.net/m0_38025747/article/details/80602651

1、nginx 安装配置 就不在这说了

2、申请SSL证书并进行配置

    

点击Get Started 

或直接访问Certbot官网

 

其中Software为服务器类型,System为服务器上系统类型。
我使用的是Ubuntu 16.04(xenial)和Nginx。

安装Cerbot

   

sudo apt-get update
    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get update
    sudo apt-get install python-certbot-nginx

使用Cerbot中的Nginx插件(自动版,可能会不行)

    sudo certbot –nginx

    此命令将自动获取证书并且Certbot会编辑Nginx配置并完成所有工作,
    只需在命令运行期间根据命令的提示输入你要配置SSL的域名即可。

    如果想自定义Nginx配置,则使用certonly子命令即可。

    sudo certbot –nginx certonly

获取SSL证书

sudo certbot –nginx -d 自己的域名

自动更新证书期限

Certbot提供的证书期限为90天,执行此命令可自动续订证书。

sudo certbot renew –dry-run

猜你喜欢

转载自blog.csdn.net/YuYan_wang/article/details/86060143