我正在尝试使用 Azure 的 LetsEncrypt 站点扩展为我的 Azure 功能启用 SSL,如所述 here 。我按照该 wiki 和此 website 中的说明进行操作.
但是,当它尝试验证网站时,我收到错误。
该错误表示无法访问 acme-challenge 页面 (404)。
这是我的.well-known/
下的web.config
:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<clear />
<add name="ACMEStaticFile" path="*" verb="*" modules="StaticFileModule" resourceType="Either" requireAccess="Read" />
</handlers>
<staticContent>
<remove fileExtension="." />
<mimeMap fileExtension="." mimeType="text/plain" />
</staticContent>
</system.webServer>
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</configuration>
有人对可能出现的问题有任何想法吗?
最佳答案
以下是您可以做到这一点的方法。
在您的函数应用中,为挑战目录创建一个新代理(这是必需的,因为挑战将是对 /.well-known/acme-challenge
/的 http 获取,并且默认情况下函数应用中的函数只会在 /api/
上响应。
代理.json
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"LetsEncryptProxy": {
"matchCondition": {
"route": "/.well-known/acme-challenge/{code}"
},
"backendUri": "http://%WEBSITE_HOSTNAME%/api/letsencrypt/.well-known/acme-challenge/{code}"
}
}
}
这里的重要设置是路由模板:/.well-known/acme-challenge/{*rest}
这将匹配所有进入挑战目录的请求。
请注意,代理是一项预览功能,您必须启用它才能正常工作。
引用: https://github.com/sjkp/letsencrypt-siteextension/wiki/Azure-Functions-Support https://blog.bitscry.com/2018/07/06/using-lets-encrypt-ssl-certificates-with-azure-functions/
关于Azure LetsEncrypt 无法访问我的函数的 .well-known/acme-challenge,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56333957/