【问题标题】:Restful azure website宁静的蔚蓝网站
【发布时间】:2016-03-24 03:29:45
【问题描述】:

我只想知道如何配置 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 GET https://ptamob.azurewebsites.net/services/customers 404(未找到)。我试图将同一组文件上传到hostinger.ph,它可以工作。我想知道如何解决这个问题,以及为什么它在托管程序中而不是在 Azure 中加载的区别。谢谢你。

【问题讨论】:

  • 您的云服务状态是“运行中”吗?

标签: php angularjs json azure azure-web-app-service


【解决方案1】:

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

所以Apache http服务器的url重写规则配置需要为IIS服务器翻译。

您可以尝试通过 url https://<your-webapp-name>.scm.azurewebsites.net/DebugConsole 访问您的 webapp 的 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 : Create an URL Rewrite Azure Web App”的Configure the URL rewrite部分。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-25
    • 2017-02-09
    • 2012-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-15
    相关资源
    最近更新 更多