宁静的azure网站


Restful azure website

我只想知道如何配置Azure,让它正确加载我的练习网站。我找到了一个教程,并在上下载了该文件http://www.angularcode.com/demo-of-a-simple-crud-restful-php-service-used-with-angularjs-and-mysql/.我在本地主机中尝试过这个Restful文件,它运行得很好,但当我使用Transmit将文件上传到Azure时,它不会加载并返回angular.min.js:72 GEThttps://ptamob.azurewebsites.net/services/customers404(未找到)。我试着将同一组文件上传到hostinger.ph,结果成功了。我想知道如何解决这个问题,以及为什么它在hostinger中加载而不是在Azure中加载的区别。非常感谢。

根据教程,我认为问题是由http服务器上的url重写规则配置引起的。Azure通过Azure IIS服务器而不是Apache http服务器支持url重写规则的功能。

因此,Apache http服务器的url重写规则配置需要转换为IIS服务器。

您可以尝试通过url https://<your-webapp-name>.scm.azurewebsites.net/DebugConsole访问Web应用程序的Kudu控制台,并在路径D:'home'site'wwwroot中配置Web.config文件。

web.config的重写规则配置如下。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Main Rule" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

请参阅文档"Azure:创建URL重写Azure Web应用程序"的Configure the URL rewrite部分。