在 Windows Azure 網站上運行 CakePHP 應用

來源:互聯網
上載者:User

 

  CakePHP是一個運用了諸如ActiveRecord、Association Data Mapping、Front Controller和MVC等著名設計模式的快速開發架構。該項目主要目標是提供一個可以讓各種層次的PHP開發人員快速地開發出健壯的Web應用,而 又不失靈活性。

  在 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>



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.