宝塔申请部署TrustAsia免费SSL证书https访问


宝塔现在一个账号只能申请3个SSL证书,超过后无法申请,只能自己申请https,方法如下:
首先打开https://freessl.cn/,在首页输入你的域名,登录账号.

根据给出的信息,到域名解析商添加 CNAME 解析记录

回到freessl.cn,检查解析记录是否已经正确添加,并记录第三步中给出的命令

连接到你的服务器,在ssh终端中执行下面脚本。建议将邮箱换成你自己的:

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

然后 关闭ssh窗口并重新连接服务器 ,执行刚刚在freessl.cn第三步中记录的命令

出现如图代表证书已经成功申请

打开宝塔面板中你要部署ssl的网站,随便部署一个证书上去(域名不需要相匹配,过期的证书也可以,或者用下面的证书)

证书:

-----BEGIN CERTIFICATE-----
MIID3DCCAsSgAwIBAgIRAPJFqahnl0A/ijcJq5PgMVQwDQYJKoZIhvcNAQELBQAw
XjELMAkGA1UEBhMCQ04xDjAMBgNVBAoTBU15U1NMMSswKQYDVQQLEyJNeVNTTCBU
ZXN0IFJTQSAtIEZvciB0ZXN0IHVzZSBvbmx5MRIwEAYDVQQDEwlNeVNTTC5jb20w
HhcNMjIwNDE0MDY0OTM1WhcNMjMwNDE0MDY0OTM1WjAdMQswCQYDVQQGEwJDTjEO
MAwGA1UEAxMFYnQuY24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9
3sUocsPsVdK6oMU689SO7L0Gjg6Z8QBqwqdP9lSKU6A5m/+LJ7qqQD1VcjAKEjTo
fBpmzfE+uvR51nh7qiB2IWHpF1JCTYPnriW/OgsdlPlutaTt8/vQuDBgFXj9C0oR
JUWTt9xNY0gIGzfEPQBeu7rer7M/un/BoIIUXtiQYeiTQMkuMZ6JZVFy243OJv8b
aulNbSeC290YdaxtuhCWjjYELGW1jxlwmDOT5EDaomYcg3CtRFhe9XVAV4ccf1HO
0hig0bfdeKQnv51R1XFCxdMSF/wAA2YI40Hb9BiTvfDXDg+ogxbd+Y3McMlELN70
nFS3i2D8zAHpOZ2JiWLJAgMBAAGjg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AtZVEk7OpvV6zp16MmEWJiU+cyrW7BPHCDdt1231AVa/x+
fQGwo8T7s1xeQ/ojxJ+O4gCZD13WOe83kdbtIPSBt6Q2SUJJFnndxrZO30yMmRoQ
L7jnSMNrzZ7rpv47QaIBTxe4E44hMcjgzaTnW/rvcyNKGIkKIKqm7j0=
-----END RSA PRIVATE KEY-----

打开网站的配置文件,记录下大约在11行处

ssl_certificate
ssl_certificate_key

记录后面的证书文件路径

进入服务器终端,执行下面命令(本例中web环境为nginx)如果你的为其他环境请参考https://blog.freessl.cn/acme-quick-start/。

  • 1,将example.com替换成你的域名#
  • 2,将fullchain-file后面的路径替换成你刚刚查到的ssl_certificate路径
  • 3,将key-file- 后面的路径替换成你刚刚查到的ssl_certificate_key路径
acme.sh --install-cert -d chenziwen.cn \
--key-file       /www/server/panel/vhost/cert/chenziwen.cn/privkey.pem  \
--fullchain-file /www/server/panel/vhost/cert/chenziwen.cn/fullchain.pem \
--reloadcmd     "/etc/init.d/nginx reload"

使用浏览器打开你的网站就可以看到效果了,享受吧!

  • 分享:
发表评论 说点什么
登录