您无权查看此目录或天蓝色页面错误 php + mySql
You do not have permission to view this directory or page error on azure with php + mySql
我已经在 Azure 中创建了一个 Web 应用程序服务并遵循了本教程
Php And MySql on Windows Azure after uploading all my files using ftp. When i visit my web app address i got this error "You do not have permission to view this directory or page". Azure web app address is Azure app link。我该如何解决这个问题或有关在 Azure 上部署 php web 的任何帮助。
由于 Azure Web Apps 使用 IIS 来托管 PHP 应用程序,这些应用程序可以通过 web.config 配置进行控制。根据我的经验,出现此问题是因为 IIS 无法找到您的 PHP 应用程序的入口文件。
例如:
1、入口文件在你应用程序的根目录下,但文件名不是默认文件,IIS会自动运行为index.php
。当您访问您的站点时,IIS 将按排序在默认文件中查找文件,运行 最先找到的文件。
--解决方案--
入口文件名为app.php
,我们可以登录Azure管理门户,在站点门户的CONFIGURE选项卡中,在[=33=下添加app.php
]default documents 部分,重新启动您的站点。
2,你的应用入口文件不在根目录下,如入口文件在根目录下的文件夹 app
中。我们可以添加一个名为 web.config
的文件来配置我们的站点。
我们在 web.config
中添加 URL 重写模块,例如:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="RewriteRequestsToPublic" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
</conditions>
<action type="Rewrite" url="app/index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
我已经在 Azure 中创建了一个 Web 应用程序服务并遵循了本教程 Php And MySql on Windows Azure after uploading all my files using ftp. When i visit my web app address i got this error "You do not have permission to view this directory or page". Azure web app address is Azure app link。我该如何解决这个问题或有关在 Azure 上部署 php web 的任何帮助。
由于 Azure Web Apps 使用 IIS 来托管 PHP 应用程序,这些应用程序可以通过 web.config 配置进行控制。根据我的经验,出现此问题是因为 IIS 无法找到您的 PHP 应用程序的入口文件。
例如:
1、入口文件在你应用程序的根目录下,但文件名不是默认文件,IIS会自动运行为index.php
。当您访问您的站点时,IIS 将按排序在默认文件中查找文件,运行 最先找到的文件。
--解决方案--
入口文件名为app.php
,我们可以登录Azure管理门户,在站点门户的CONFIGURE选项卡中,在[=33=下添加app.php
]default documents 部分,重新启动您的站点。
2,你的应用入口文件不在根目录下,如入口文件在根目录下的文件夹 app
中。我们可以添加一个名为 web.config
的文件来配置我们的站点。
我们在 web.config
中添加 URL 重写模块,例如:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="RewriteRequestsToPublic" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
</conditions>
<action type="Rewrite" url="app/index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>