将Grav CMS部署到Azure

use*_*794 2 php bitbucket azure content-management-system grav

在通过Bitbucket 仓库将基于Grav CMS(http://getgrav.org)的网站部署到Azure后,我收到消息"您无权查看此目录或页面".当我尝试浏览网站时.我还没有更改任何配置设置.

Gar*_*SFT 8

由于在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>
Run Code Online (Sandbox Code Playgroud)

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

如有任何疑问,请随时告诉我.