我正在使用 acme.sh 为较旧的服务器创建证书,出于各种原因我需要运行该证书。但是,我缺少 .well-known/acme-challenge 部分的内容。
当我运行脚本时:
acme.sh --issue --nginx -d fish.pre.imb.co --test --debug 2
我收到一个错误:
fish.pre.imb.co:Verify error:197.214.119.177: Invalid response from https://fish.pre.imb.co/.well-known/acme-challenge/0wDIf77g9i9U1fx75tGX9UEOK_d4-A3ZdORclyTd14k: 404
但是,如果我将一个具有上述查询名称的文件放入目录中,它就可以正常解析。
这是我的 nginx conf 文件:
upstream puma_fisheagle {
server 192.168.abc.xyz:1234 max_fails=3 fail_timeout=30s;
}
# IMB external system api server setup.
server {
resolver_timeout 10s;
server_name fish.pre.imb.co;
root /var/local/www/fisheagle/public;
access_log /var/log/nginx/fisheagle.log;
rewrite_log on;
try_files $uri/index.html $uri @puma_fisheagle;
location @puma_fisheagle {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_read_timeout 1800s;
proxy_redirect off;
proxy_pass http://puma_fisheagle;
proxy_connect_timeout 2;
}
location /.well-known/acme-challenge {
default_type "text/plain";
allow all;
root /var/local/www/acme;
}
location /nginx_status {
stub_status on;
access_log off;
allow 192.168.abc.0/24;
# deny all;
}
error_page 404 /404.html;
error_page 422 /422.html;
error_page 500 503 504 /500.html;
error_page 502 /502.html;
client_max_body_size 10m;
keepalive_timeout 10m;
listen 443 ssl;
ssl_certificate /etc/acme.sh/certs/fish.pre.imb.co/fullchain.cer;
ssl_certificate_key /etc/acme.sh/certs/fish.pre.imb.co/fish.pre.imb.co.key;
# intermediate configuration
# old configuration
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/private/ffdhe4096.pem;
ssl_ecdh_curve secp384r1;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
ssl_session_timeout 60m;
ssl_session_cache shared:SSL:50m;
}
server {
if ($host = fish.pre.imb.co) {
return 301 https://$host$request_uri;
}
server_name fish.pre.imb.co;
listen 80;
return 404;
}
因此,acme 似乎无法将文件写入目录?我的意思是,如果我手动写入,配置会读取它。
我错过了什么?
这是 acme.sh 调试文件:https://pastebin.com/6zHGAprA
该
--nginx
参数指示acme.sh
进行额外的 nginx 配置以服务于 ACME 挑战。但是,这不适用于所有 nginx 配置,因为acme.sh
无法适应所有配置。配置的最佳方式是告诉
acme.sh
在哪里放置挑战,并让它使用您现有的 nginx 配置: