Symfony 3部署到Azure - 路由问题

时间:2016-05-03 20:20:40

标签: php git azure symfony

我创建了一个项目,现在我正在尝试部署到Azure。

开始遇到很多问题...我无法使用bitbucket进行部署... Azure每次都会在Cache目录中显示错误时返回错误...我清除了目录并显示相同的错误。< / p>

我使用FTP上传。

现在,我遇到了这个问题:

这是我的网址:

http://attrative.azurewebsites.net/

什么都没发生......我需要使用完整的路径:

http://attrative.azurewebsites.net/web/app.php

好的,好的,工作......但是当登录时,我使用了route name =“plataforma”,登录时,Symfony会重定向到这条路径:

http://attrative.azurewebsites.net/plataforma

在localhost上,它运行得很完美......但是在天蓝色的情况下,如果我将manlualy更改为:

http://attrative.azurewebsites.net/web/app.php/plataforma

我该如何解决这个问题? 有一种方法可以使用git进行部署吗?我在这个链接上按照教程没有成功:

Symfony Cookbook - Deploying to Microsoft Azure Website Cloud

感谢您的提示......

1 个答案:

答案 0 :(得分:0)

感谢@Gary Liu - MSFT。

他提供了我找到此链接的文档链接:

Git - symfony-azure-edition

在这个链接上,我收到了这个web.config文件:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <defaultDocument enabled="true">
            <files>
                <clear />
                <add value="app.php" />
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
                <clear />
                <rule name="blockAccessToPublic" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{URL}" pattern="/web/*" />
                    </conditions>
                    <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
                </rule>
                <rule name="RewriteAssetsToPublic" stopProcessing="true">
                    <match url="^(.*)(\.css|\.js|\.jpg|\.png|\.gif)$" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    </conditions>
                    <action type="Rewrite" url="web/{R:0}" />
                </rule>
                <rule name="RewriteRequestsToPublic" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    </conditions>
                    <action type="Rewrite" url="web/app.php/{R:0}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

只需放入根文件夹和ta-da !!!!

问题解决了!!!