当修改虚拟路径而不是 wwwroot 时,让我们加密质询请求失败

Lets encypt challenge requests fail when virtual path is modified and not wwroot

我正在为我的所有证书切换到 Lets Encrypt 并且网络作业在我的 Laravel 和 Zend 应用程序上失败,因为质询请求失败。对于我的静态站点,一切正常,对于 Laravel/Zend 站点,虚拟路径已从 'wwwroot' 修改为 'wwwroot/public'。

我不确定我需要在 web.config 文件中添加什么才能将质询请求传递给“/well-known/acme-challenge”。

我的 web.config 如下所示,我尝试将 '/.well-known/acme-challenge/web.config' 的内容移入其中,尝试将挑战请求传递给 '/.well-已知...',添加了其他映射,我无法使用任何东西。

到目前为止,为了每个季度更新证书,我一直在将虚拟路径修改回 'wwwroot',然后手动 运行 网络作业,显然这不是一个好的解决方案。

web.config 我的应用

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Imported Rule 1" stopProcessing="true">
          <match url="^(.*)/$" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
        </rule>
        <rule name="Imported Rule 2" stopProcessing="true">
          <match url="^" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

web.config 对于 ./well-known/acme-challenge

<?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>

我正在使用 SJKP 的 Azure Let's Encrypt 扩展的 0.9.3

提前致谢。

原来是我自己回答的

我需要添加路径映射。

虚拟路径:/.well-known 物理路径:site\wwwroot.well-known 类型:目录