1.9 KiB
前期准备
主要是接下来安装acme时的gfw问题。如果是境内服务器,则有可能需要如下步骤。
-
小飞机的局域网内的代理地址。因为get.acme.sh中包含的脚本请求地址可能会被墙
export http_proxy="172.18.184.139:10082"export https_proxy="172.18.184.139:10082" -
是因为据说在此加入上面的export命令可以实现开机自动开启代理。但没有尝试
vim /etc/bashrc
- 同上
vim /etc/profile
安装acme
-
安装acme
curl https://get.acme.sh | sh安装完毕后,关闭这个连接的console再重新打开。
-
将dns api的key和secret存入环境变量。此处为阿里云,事前已经给对应SAM子账户分配了FullDnsApiAccess的权限。参见: https://blog.csdn.net/chen249191508/article/details/98088553
export Ali_Key="key"export Ali_Secret="secret"参见保密区域获取真实内容。注意,阿里云的控制台中,这两个值只在添加SAM子账户的时候出现,需要马上自行保存
获取证书
-
申请安装证书。加--debug参数可以显示更多细节
acme.sh --debug --issue --dns dns_ali -d dev.woyue.org -d *.dev.woyue.org -
安装完毕后,检验是否配置自动任务
crontab -e -
确认当前证书
acme.sh --list
安装证书
-
复制证书:
mkdir -p /srv/certbot/conf/live/dev.woyue.org
acme.sh --installcert -d dev.woyue.org -d *.dev.woyue.org
--key-file /srv/certbot/conf/live/dev.woyue.org/privkey.pem
--fullchain-file /srv/certbot/conf/live/dev.woyue.org/fullchain.pem
--reloadcmd "docker restart nginxdocker_nginx_1"注意,最后的nginxdocker_nginx_1为nginx容器的名称。请根据实际情况修改。或不加此参数,手动重启nginx。
-
生成:dhparams文件
openssl dhparam -out /srv/certbot/conf/ssl-dhparams.pem 2048