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 ( 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"?>
        <rule name="RewriteRequestsToPublic">
          <match url="^(.*)$" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
          <action type="Rewrite" url="public/{R:0}" />
        <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" />
          <action type="Rewrite" url="public/index.php/{R:1}" appendQueryString="true" />

8 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.

  3. I have faced several performance issues running laravel on azure web apps; seemingly due to the poor disk performance within the azure service.

    • Hi, what kind of performance issues are you seeing? Azure is being used by a lot of companies, ranging from small to enterprise, so curious to learn about your challenges.

      • It seems to be largely with how blade operates, Azure appears to have severely restricted disk performance and the blade template engine does a lot of disk operations especially when templates have a lot of partials or inheritances.

        In addition to the above complaint, the Laravel developers recently removed wincache support from the cache package ( wincache is available on Azure sites out of the box but with the removal of wincache support you can’t use it with Laravel without juryrigging.

        The issue isn’t running php on Azure sites because some really simple projects that use no framework and are essentially a handful of php files load in 30-60ms, whereas Laravel projects can take up to two full seconds for a page to first load and usually 500-900ms thereafter, all my debugging and bench-marking has tied this down to disk io.

        In addition to the apparent slow performance of using large php frameworks with Azure sites I have also used a simple benchmark script to check execution times and Azure app service performed worse than the cheapest linode vps, results can be found here

        I hope this helps 🙂

        • Thanks for the detailed response! I must admit it’s been a while since this project and it was fairly small-scale, so we likely haven’t hit the limits you describe. A lot has changed since writing this post and I suggest you check out the various ways you can run Linux on Azure nowadays, which will likely will remove the wincache restriction you’re seeing.

Leave a Reply