首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将Grav部署到Azure

将Grav部署到Azure
EN

Stack Overflow用户
提问于 2016-07-04 03:33:07
回答 2查看 954关注 0票数 2

在部署了一个基于Grav (http://getgrav.org)的网站后,我收到消息:“您没有查看此目录或页面的权限。”当我试图浏览这个网站的时候。我还没有更改任何配置设置。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-07-04 06:07:40

由于运行在Azure上的PHP应用程序托管在IIS上,因此您的问题发生是因为您没有在IIS中配置URL重写模式。

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

代码语言:javascript
复制
<?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文件夹中找到这个配置文件。或者您可以参考github的https://github.com/Vivalldi/grav/blob/develop/webserver-configs/web.config

如有任何进一步的关注,请随时通知我。

票数 8
EN

Stack Overflow用户

发布于 2018-03-14 15:45:15

到2018年3月,我发现我还需要安装composer扩展,以便正确加载网站。

详情请参见https://learn.microsoft.com/en-gb/azure/app-service/web-sites-php-configure#how-to-enable-composer-automation-in-azure

如果不这样做,我将看到一个空白页时,试图加载网站。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38176583

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档