Which Is The Best Stack For Hosting A Website On Azure

Choosing the right stack for your backend might be really hard. Considering there are so many options out there its really hard to decide which one to go with. When I started with backend development it was really hard for me to choose the right stack considering there were so many options out there. But one can broadly classify the stacks into two – Custom or Prebuilt.

Now its upto you to go with a custom stack or a prebuilt one. In a custom you have the power to do almost everything but security and updates might be a concern. In a prebuilt one the security and updates are much better you can just run certain commands to update it. But here there is one problem that things might be old. PHP might not be of the latest version or Ubuntu. So it completely depends on the developer’s experience. If you are new I would recommend a prebuilt one as security might be a concern.

Now coming to the best stack which you could use for Microsoft Azure. I tried a lot of different stacks, prebuilt ones and custom ones. I will be showing you the results so that you could decide yourself. I saw Nginx performs much better than Apache. Considering that Apache had PHP7 and Nginx had PHP5.6 that really didn’t matter. PHP7 is considered to be 2x faster than PHP 5.6 but a lot of plugins in WordPress or in your custom site might not work with it since it is very new and developers are still working on it. It might not be that stable also. Nginx also has its own native caching system “FastCGI” it’s considered to be the fastest caching system out there which Apache lacks and it does show in the results.

Apache with PHP7

Nginx with PHP7

As you can see the results above show clearly that Nginx is the true winner and Apache is nowhere in the picture. Let it be load times or Caching everything is better in Nginx and Apache is far away from winning. Here are another set of images which shows that Nginx (PHP5.6 and FastCGI caching) is better than Nginx(PHP 7 without FastCGI caching)

PingDom Results On Apache with PHP7

PingDom Results On Nginx(Without Cache) with PHP7

PingDom Results On Nginx(With Cache) with PHP5.6

As you can see above in load time there is a massive difference when Caching is enabled. So for me the perfect stack on Microsoft Azure will be Nginx with FastCGI Cache and PHP5.6 please do let me know if you think that a different stack would be better 🙂