Azure hosting LEMP with PHP 7.1 and Laravel 5.4 — Part 2

This article discusses getting the rest of the LEMP stack up and running from the command line in the Azure virtual machine host we created in Part 1.

The following commands are being run from a Mac OS X machine and should be translatable to a Linux or Windows environment. The installation scripts that follow have been tested on Ubuntu 16.04 LTS.

Bold text shows commands as they should be entered literally by the reader at the command prompt.

Italicized capitalized text inside inclusive curly braces, ‘{LIKE_THIS}’, shows text that should be replaced with user-supplied values.


We have our ‘L’, now let’s create the rest of the acronym.

Before we create the rest of the stack, the Azure virtual machine host needs to be accessible to the outside world.


az vm open-port --port 80 --priority 900 --resource-group {UNIQUE_RESOURCE-GROUP_NAME} --name {UNIQUE_VIRTUAL-MACHINE_NAME}

Install Scripts

The following are three scripts that will be copied over to local, then host, and finally executed on the host:

There is a lot going on in those scripts and ‘’ in particular has been commented to express what is happening.

Please feel free to use the comment section to ask for further explainantion on parts of the script.

Let’s move on to execute the following:

Copy to Local

curl --silent --location --output --output --output mysql_credentials.cnf && chmod +x

Copy to Host

scp -pq mysql_credentials.cnf $USER@{UNIQUE_VIRTUAL-MACHINE_NAME}

The options for secure copy (scp) are preserve file (-p) and quiet (-q).

Run on Host


The last command above will start the install process on the host and you should see output on your terminal as the lines in the script are executed. When the final command is executed, the example Laravel application should be viewable through a web browser:


At this point you can create users and log into the example application.

Laravel Example Application


In this article we have completed installation of a Nginx Laravel application using MySQL to store created users in a Azure virtual machine host. The final part (Part 3) will add SSL to Nginx so that users can access the example application through HTTPS.

Daydreaming night owl, giver of unsolicited advice, software engineer by passion, always learning and ever living...

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store