#安装 acme.sh
curl https://get.acme.sh | sh
#确保 nginx安装了 http_v2_module
nginx源码目录下
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module
make && make install
pkall nginx
nginx
#阿里云的授权配制
# 替换成从阿里云 域名账号 后台获取的密钥(https://usercenter.console.aliyun.com/)
export Ali_Key="key"
export Ali_Secret="secret"
#开始生成
acme.sh --issue --dns dns_ali -d www.baidu.com
这里可以使用通配符的域名例如
acme.sh --issue --dns dns_ali -d *.baidu.com
#nginx配置
server {
server_name xx.domain.com;
listen 443 http2 ssl;
ssl_certificate_key /path/.acme.sh/domain/domain.key;
ssl_trusted_certificate /path/.acme.sh/domain/ca.cer;
ssl_certificate /path/.acme.sh/domain/fullchain.cer;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:10086;
}
}
#停止
nginx -s stop
#重启
nginx
更新
重新执行生成命令 并且nginx -s reload
参考https://my.oschina.net/kimver/blog/1634575?p=3&temp=1521449027784