Friday, 3 February 2017

Install a fresh copy of Laravel 5.4 or any Php Web App on Azure using the *NEW PORTAL* - 2017 Lastest Tuitorial

This Tuitorial will show you how to install a fresh copy of  Laravel 5.x on Microsoft Azure, in just 5 minutes.

The Old Azure Portal cannot be used no longer to publish web apps. If you try using the old portal to publish, you will face unknown errors. Best to use the new portal, which comes with the latest features and settings


In the left menu, select App Services and create a new web app.





Give your app name  and create a resource if you don't already have one





You can check you the app deployment status by click on the notification icon in the right.




Now again open app services, and select you app, now you will get all your settings , url endpoint,
ftp connection







Now, copy your url end point / paste in the browser and add the word scm between your app name and azure websites

http://<appname>.scm.azurewebsites.net


For ex: My url is

http://tuitorial.azurewebsites.net

http://tuitorial.scm.azurewebsites.net - LIKE THAT


This will open the source control management dashboard for your app




Next select Site Exentions, select the gallery tab and search for composer



Install by click the Plus button

You have to restart the site for settings to take effect


Next select debug console and select cmd.

This will open the command line for your app in the browser.



Check to make sure php and composer are working with following commands

php -v

composer -v

Then,

Navigation to site > wwwroot folder.

This is the root folder for your app.



This is the command which you can use to install a fresh copy of laravel.

You can find this command in the laravel docs.

composer create-project --prefer-dist laravel/laravel blog


Once everything is installed, make sure you copy the Application Key generated, from the command line



We need to paste this key in the app settings.

Next open app settings from azure portal , a new flyout menu opens, scroll to till the end,

You will find Virual applications and directories





Change the directory value to the following - site\wwwroot\<appname>\public

You can change the version of php very easily in the general setting, by selecting the php version dropdown menu. Choose 5.6 or 7.0
whichever you prefer




Your .env file is useless here, it will work only in localhost,

When you are deploying your app on server, you have set this value explicitly from the dashboard

This is true for Azure, Aws, Digital Ocean, or which ever server you are using to deploy


Now, lets set some basic setting required for the app to run

In the same flyout menu, scroll down to App settings

set these values for you app





Now the Save button at the top. DON'T FORGET THAT, that is most critical step.



Now go you end point url, now you should see the laravel home page.

Congratulations, YOU HAVE DONE IT.

















No comments:

Post a Comment