New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nginx 部分 https 301 重定向写法导致的问题(不是bug) #5058
Comments
Please upgrade to the latest code and try again first. Maybe it's already fixed. |
我也遇到了同样的问题,即使我已经使用了acme.sh --upgrade更新到了最新版本。
这段重定向的代码优先级比acme生成的配置更高。 因为我不确定acme生成的nginx配置是否放置在最前放,以确保优先级。所以我自己手动固定了这个配置:
|
属实这个坑都好久了! |
只需要改为
|
nginx 的重定向写法太自由了, 所以很难有一个万全的写法. 如果有请提交代码, 否则, 就使用webroot 方法吧. |
信息
起因
我长期使用nginx作为web server,而每次当我使用 acme.sh 搭配 nginx 的时候,大部分时候都会遇到
Invalid response from https://domain/acme-challenge/xxx: 404
的问题,而一些域名就没有问题。问题
我长期对此深感疑惑,直到某一次,我在证书更新的时候想起来 nginx 配置文件有误,在脚本执行中途退出执行去编辑 nginx 配置,发现本脚本实现 nginx 自动更新是用如下方式完成的:
而如果配置 nginx 时重定向 http(80) 请求到 https(443) 的时候使用的是如下方式:
就会出现:请求忽略了
location
,直接被 301 重定向到 https(443),而由于脚本未在 https(443) 的配置中加入验证相关配置,导致出现 let's encrypt 对域名所有权验证时候返回 404 的问题。方案
我目前是通过给 301 重定向加了个
location /
的条件临时解决了,而对于脚本来说,解决方案也很简单:临时屏蔽相关配置段落中的return 301 xxx;
和return 302 xxx;
,或者在相关域名的 https(443) 配置下也添加用于校验的配置段即可。The text was updated successfully, but these errors were encountered: