Search
Close this search box.

通过acme.sh配置ssl证书

安装acme.sh

官方地址:

https://github.com/acmesh-official/acme.sh

安装,邮箱可以随便写,用于接收证书过期等信息

				
					curl https://get.acme.sh | sh -s email=my@email.com
				
			

使环境变量生效

				
					source ~/.bashrc
				
			

通过dns api申请证书,导入key

cloudflare导入key和cf邮箱账号

				
					export CF_Key="xxx"
export CF_Email="my@email.com"
				
			

如果是cloudflare区域API令牌,则导入token

				
					export CF_Token="xxx"
				
			

dns验证申请证书

				
					acme.sh --dns dns_cf --issue \
-d chaflare.com -d *.chaflare.com \
-d *.domain.com
				
			

为nginx安装证书

				
					~/.acme.sh/acme.sh --install-cert -d chaflare.com \
        --key-file   /etc/nginx/ssl/private.key \
        --fullchain-file /etc/nginx/ssl/fullchain.cer \
        --reloadcmd  "nginx -s reload"
				
			
Share the Post:

Related Posts