在 Windows Azure 上使用 CakePHP 的步骤:
下载 CakePHP 2.2.1
解压下载的压缩包
发布到 Windows Azure 网站
通过 FTP 上传文件到 Windows Azure 或者;
使用 Git 发布 Windows Azure 网站应用
构建应用
我使用的是 CakePHP Blog Tutorial 来测试功能
CakePHP on IIS (aka Windows Azure Web Sites)
需要注意的是 Windows Azure 用的是 IIS 来运行 CakePHP 应用,因此需要一个 web.config 来描述应用,因为 IIS 不支持 .htaccess 文件。
下面是在 CakePHP 网站上的一个 web.config 的示例,用于在 Windows Azure 网站上运行 CakePHP 应用:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="/" />
</rule>
<rule name="Imported Rule 3" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}" />
</rule>
<rule name="Imported Rule 4" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>