gpt4 book ai didi

php - 将 Grav CMS 部署到 Azure

转载 作者:行者123 更新时间:2023-12-02 09:16:18 25 4
gpt4 key购买 nike

通过 Bitbucket 存储库将基于 Grav CMS ( http://getgrav.org ) 的网站部署到 Azure 后,我收到消息“您无权查看此目录或页面”。当我尝试浏览该网站时。我尚未更改任何配置设置。

最佳答案

由于在 Azure 上运行的 PHP 应用程序托管在 IIS 上,因此出现您的问题是由于您尚未在 IIS 中配置 URL 重写模式。

尝试在应用程序的根目录中创建一个名为 web.config 的文件,其中包含以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<remove value="index.php" />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="request_filename" stopProcessing="true">
<match url="." ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
<rule name="user_accounts" stopProcessing="true">
<match url="^user/accounts/(.*)$" ignoreCase="false" />
<action type="Redirect" url="error" redirectType="Permanent" />
</rule>
<rule name="user_config" stopProcessing="true">
<match url="^user/config/(.*)$" ignoreCase="false" />
<action type="Redirect" url="error" redirectType="Permanent" />
</rule>
<rule name="user_error_redirect" stopProcessing="true">
<match url="^user/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$" ignoreCase="false" />
<action type="Redirect" url="error" redirectType="Permanent" />
</rule>
<rule name="cache" stopProcessing="true">
<match url="^cache/(.*)" ignoreCase="false" />
<action type="Redirect" url="error" redirectType="Permanent" />
</rule>
<rule name="bin" stopProcessing="true">
<match url="^bin/(.*)$" ignoreCase="false" />
<action type="Redirect" url="error" redirectType="Permanent" />
</rule>
<rule name="backup" stopProcessing="true">
<match url="^backup/(.*)" ignoreCase="false" />
<action type="Redirect" url="error" redirectType="Permanent" />
</rule>
<rule name="system" stopProcessing="true">
<match url="^system/(.*)\.(txt|md|html|yaml|php|twig|sh|bat)$" ignoreCase="false" />
<action type="Redirect" url="error" redirectType="Permanent" />
</rule>
<rule name="vendor" stopProcessing="true">
<match url="^vendor/(.*)\.(txt|md|html|yaml|php|twig|sh|bat)$" ignoreCase="false" />
<action type="Redirect" url="error" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<httpRuntime requestPathInvalidCharacters="&lt;,&gt;,*,%,&amp;,\,?" />
</system.web>
</configuration>

然后将其与您的应用程序一起部署到 Azure。此外,您还可以在 grav 应用程序的 webserver-configs 文件夹中找到此配置文件。或者您可以引用https://github.com/Vivalldi/grav/blob/develop/webserver-configs/web.config在 github 上。

如有任何进一步的疑问,请随时告诉我。

关于php - 将 Grav CMS 部署到 Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38176583/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com