安装acme自动申请网站SSL证书升级HTTPS
自动验证域名
这个命令摘自proxySU的客户端自动申请更换证书,把域名解析到主机IP上,使用caddy会自动启动一个http服务为域名做域名验证,省去了自动配置网站的步骤,注意如果80端口被占用就要先停掉,适合没有web服务的服务器使用
acme.sh --force --debug --issue --standalone -d proxy2.xxx.com --pre-hook "systemctl stop caddy" --post-hook "systemctl start caddy" --server letsencrypt1. 安装 acme.sh
安装很简单, 一个命令:
curl https://get.acme.sh | sh -s email=my@example.com普通用户和 root 用户都可以安装使用. 安装过程进行了以下几步:
把 acme.sh 安装到你的 home 目录下:
~/.acme.sh/并创建 一个 shell 的 alias, 例如 .bashrc,方便你的使用: alias acme.sh=~/.acme.sh/acme.sh
自动为你创建 cronjob, 每天 0:00 点自动检测所有的证书, 如果快过期了, 需要更新, 则会自动更新证书.
更高级的安装选项请参考: https://github.com/Neilpang/acme.sh/wiki/How-to-install
安装过程不会污染已有的系统任何功能和文件, 所有的修改都限制在安装目录中: ~/.acme.sh/
中国大陆用户请参考:
https://github.com/acmesh-official/acme.sh/wiki/Install-in-China以上链接说明内容如下:
如果你的安装服务器位于中国大陆境内, 访问 github 可能会不成功. 所以安装可能会失败.
推荐从这里下载安装:
#centos7.9系统,实操时报错:No such file or directory
https://gitee.com/neilpang/acme.sh
#从原仓库复制了一个20240120
https://e.coding.net/youxianbo/tools/acme.sh.git
安装步骤:
根据 How-to-install#3-or-git-clone-and-install
git clone https://gitee.com/neilpang/acme.sh.git
cd acme.sh
./acme.sh --install -m my@example.com# 网站服务器上申请
#nginx配置
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
default_type text/html;
allow all;
}
#申请命令
acme.sh --issue --webroot /home/wwwroot/xxx -d www.xxx.com,m.xxx.com
# 手动DNS申请
acme.sh --issue -d www.xxx.com,m.xxx.com --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please
#会报错,提示需要解析
#手动解析后再尝试执行命令,加上 --renew 参数
acme.sh --renew -d www.xxx.com,m.xxx.com --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please
#如果同时申请多个域名,--renew出现以下报错的话,可能需要改成单个域名才能找到申请的目录
#报错:
'm.xx.com,www.xx.com' is not an issued domain, skipping.
#换成单个域名(第一个域名,因为申请的时候key放到这个目录了m.xx.com_ecc/m.xx.com.key,renew的时候去m.xx.com,www.xx.com这个目录找,找不到文件)
acme.sh --renew -d m.xx.com --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please检测网站证书
https://www.ssllabs.com/ssltest/index.html
https://myssl.com/dns_check.html#ssl_verify版权属于:Joyber
本文链接:https://blog.qqvbc.com/default/30.html
转载时须注明出处及本声明