Running Laravel on Windows Azure Web Sites

A few days back I worked with a company that wanted to move their on-premises PHP solution to Windows Azure Web Sites. They are using Laravel (http://laravel.com/) as a framework for their solutions and they needed a quick and flexible way of publishing their sites to Windows Azure.

It turns out the solution to running Laravel on Windows Azure Web Sites was really quite simple: download the latest version of Laravel, add a web.config to the root of the unpacked ZIP-file to rewrite the URLs and upload to a Windows Azure Web Site via FTP. The web.config should have the following two rewrite rules:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="RewriteRequestsToPublic">
          <match url="^(.*)$" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
          </conditions>
          <action type="Rewrite" url="public/{R:0}" />
        </rule>
        <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="public/index.php/{R:1}" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

4 thoughts on “Running Laravel on Windows Azure Web Sites

  1. Pingback: Windows Azure Web サイトで Laravel を動かす | 雪猫ノート

  2. Pingback: 5 Things to Know Before/While You Learn Laravel (and try to put it on Windows Azure) | Denvycom

    • Hi Peter,

      As this was something we’ve done with a partner of ours, I really couldn’t say. I haven’t heard of any major performance issues from them, personally.

Leave a Reply