centos下acme.sh续期证书比较方便,但是windows下的各种web服务器配置续期复杂,我们可以采用第三方的服务器远程验证,来续期ssl证书。
acme 的工作原理是:
1、发起一个新证书请求到官方,给出证书域名(pic.xg98.com)和存放证书验证文件的本地目录(/home/www/pic.xg98.com/wwwroot/)
2、官方访问验证文件来完成域名有效性的验证,然后发放证书
程序在生成验证文本文件 /home/www/pic.xg98.com/wwwroot/xxx
官方程序访问如下地址:
3、在本地验证的时候过程简单,现在我们 /.well-known/acme-challenge 放到单独一台服务器来验证 http://https.xg98.com
那么访问的实际url就成了 http://https.xg98.com/.well-known/acme-challenge/xxx
====================================================================================
第三方验证服务器的配置 (centos系统,安装好 acme ,默认在 ~/.acme/ 目录)
执行一个验证获取证书
执行一个证书安装,通过上传脚本 acme_pic.xg98.com.sh 上传到pic.xg98.com服务器
注意,先把自己存放证书的目录建立下,自己知道在哪里就行了,我就放到 nginx/ssl/pic.xg98.com 目录
acme_pic.xg98.com.sh
WEB服务器端的配置 (其实就是一个目录的反向代理)
apache
nginx
iis6 (虽然win2003年代久远,但是有实现方法,使用 ISAPI_rewrite 3.1)
a、说明ISAPI_rewrite 3.1安装后,ISAPI筛选器中能看到 ISAPI_rewrite 这是网址转发需启用,然后在iis的 web服务扩展中能看到 ISAPI_rewrite3(这就是反向代理服务程序ISAPI_RewriteProxy.dll,也需要启用)
b、在网站的属性 - 主目录 - 配置 这里,可以看到映射tab,新增加一个 .rwhlp ,应用程序复制带引号的 "C:\Program Files\Helicon\ISAPI_Rewrite3\ISAPI_RewriteProxy.dll"
c、网址转发 .access中加上转发代码
最后
第三方验证完成,把证书传到web服务器之后,web服务器可以设置一个定期重启web服务(iis/apache/nginx)的计划任务,以便重新加载ssl新证书,简单的就忽略不记录了。
评论Feed: http://blog.xg98.com/feed.asp?q=comment&id=3022
acme 的工作原理是:
1、发起一个新证书请求到官方,给出证书域名(pic.xg98.com)和存放证书验证文件的本地目录(/home/www/pic.xg98.com/wwwroot/)
acme.sh --issue -d pic.xg98.com --webroot /home/www/pic.xg98.com/wwwroot/ --nginx
2、官方访问验证文件来完成域名有效性的验证,然后发放证书
程序在生成验证文本文件 /home/www/pic.xg98.com/wwwroot/xxx
官方程序访问如下地址:
http://pic.xg98.com/.well-known/acme-challenge/xxx
3、在本地验证的时候过程简单,现在我们 /.well-known/acme-challenge 放到单独一台服务器来验证 http://https.xg98.com
那么访问的实际url就成了 http://https.xg98.com/.well-known/acme-challenge/xxx
====================================================================================
第三方验证服务器的配置 (centos系统,安装好 acme ,默认在 ~/.acme/ 目录)
执行一个验证获取证书
acme.sh --issue -d pic.xg98.com --webroot /home/www/https.xg98.com/wwwroot/ --nginx
执行一个证书安装,通过上传脚本 acme_pic.xg98.com.sh 上传到pic.xg98.com服务器
注意,先把自己存放证书的目录建立下,自己知道在哪里就行了,我就放到 nginx/ssl/pic.xg98.com 目录
acme.sh --install-cert -d pic.xg98.com --key-file /usr/local/nginx/ssl/pic.xg98.com/privkey.key --fullchain-file /usr/local/nginx/ssl/pic.xg98.com/fullchain.cer --ca-file /usr/local/nginx/ssl/pic.xg98.com/ca.cer --reloadcmd "/root/acme_pic.xg98.com.sh"
acme_pic.xg98.com.sh
#!/bin/sh
HOSTNAME='pic.xg98.com'
cd /usr/local/nginx/ssl
ftp -n<<!
open 111.*.*.* 21
user httpsftpuser pwd***
binary
cd ${HOSTNAME}
lcd ${HOSTNAME}
prompt
mput *
close
bye
!
HOSTNAME='pic.xg98.com'
cd /usr/local/nginx/ssl
ftp -n<<!
open 111.*.*.* 21
user httpsftpuser pwd***
binary
cd ${HOSTNAME}
lcd ${HOSTNAME}
prompt
mput *
close
bye
!
WEB服务器端的配置 (其实就是一个目录的反向代理)
apache
<VirtualHost *:80>
DocumentRoot "xxx"
ServerName pic.xg98.com
ProxyPass /.well-known/acme-challenge/ http://https.xg98.com/.well-known/acme-challenge/
ProxyPassReverse /.well-known/acme-challenge/ http://https.xg98.com/.well-known/acme-challenge/
xxx
DocumentRoot "xxx"
ServerName pic.xg98.com
ProxyPass /.well-known/acme-challenge/ http://https.xg98.com/.well-known/acme-challenge/
ProxyPassReverse /.well-known/acme-challenge/ http://https.xg98.com/.well-known/acme-challenge/
xxx
nginx
server {
listen 80;
server_name pic.xg98.com;
location ^~ /.well-known/acme-challenge/ {
proxy_pass http://https.xg98.com;
proxy_set_header Host https.xg98.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
return 301 https://$host$request_uri;
}
access_log off;
}
listen 80;
server_name pic.xg98.com;
location ^~ /.well-known/acme-challenge/ {
proxy_pass http://https.xg98.com;
proxy_set_header Host https.xg98.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
return 301 https://$host$request_uri;
}
access_log off;
}
iis6 (虽然win2003年代久远,但是有实现方法,使用 ISAPI_rewrite 3.1)
a、说明ISAPI_rewrite 3.1安装后,ISAPI筛选器中能看到 ISAPI_rewrite 这是网址转发需启用,然后在iis的 web服务扩展中能看到 ISAPI_rewrite3(这就是反向代理服务程序ISAPI_RewriteProxy.dll,也需要启用)
b、在网站的属性 - 主目录 - 配置 这里,可以看到映射tab,新增加一个 .rwhlp ,应用程序复制带引号的 "C:\Program Files\Helicon\ISAPI_Rewrite3\ISAPI_RewriteProxy.dll"
c、网址转发 .access中加上转发代码
RewriteEngine On
RewriteBase /
RewriteCompatibility2 On
RewriteProxy ^\.well-known/acme-challenge/(.*)$ http://https.xg98.com/.well-known/acme-challenge/$1 [L]
RewriteBase /
RewriteCompatibility2 On
RewriteProxy ^\.well-known/acme-challenge/(.*)$ http://https.xg98.com/.well-known/acme-challenge/$1 [L]
最后
第三方验证完成,把证书传到web服务器之后,web服务器可以设置一个定期重启web服务(iis/apache/nginx)的计划任务,以便重新加载ssl新证书,简单的就忽略不记录了。
[最后修改由 admin, 于 2026-07-06 17:17:24]
评论Feed: http://blog.xg98.com/feed.asp?q=comment&id=3022
这篇日志没有评论。
此日志不可发表评论。






