Reputation: 345
I have created a web app service in azure and followed this tutorial 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. How can I solve this problem or any help regarding deployment of php web on Azure.
Upvotes: 2
Views: 10072
Reputation: 13918
As Azure Web Apps uses IIS to host PHP applications, which can be controlled by web.config configurations. Per my experience, the issue occurred because IIS cannot find the entrance file of your PHP application.
For example:
1, the entrance file is in the root directory of your application, but the file name is not a default document which will automatically run IIS as index.php
. When you visit your site, IIS will find the file in the default documents by the sort, and run the first found file.
--Solution--
E.G. the entrance file is named app.php
, we can login on Azure manage portal, in the CONFIGURE tab of your site portal, add app.php
under the default documents section, restart your site.
2,the entrance file in your application is not in the root directory, e.g. the entrance file is in a folder app
in the root directory. We can add a file named web.config
to configure our site.
We add URL rewrite module in web.config
, like:
<?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>
Upvotes: 10