Setup Nginx and Ubuntu on Azure

Advertisement

While migrating a WordPress site from Apache to Nginx on AWS, I started setting up the equivalent environment in Azure and thought it would be nice to write the steps down.

First I want to start with the basic setup.

Overview:

  1. Install and Setup Nginx on Azure with a Ubuntu VM
  2. PHP with Configuration
  3. MySQL
  4. Setup WordPress
  5. Configure Nginx and WordPress

Please be aware that the steps I describe in this article may cost you money. Please see the Azure pricing page first.

Create your Ubuntu VM

At first we want to create a new Ubuntu VM.
Login to the new portal, select “Virtual machines” and search for Ubuntu Server.
Azure Ubuntu Create VM
Next click “Create” and you will see the following menu:
Azure Ubuntu Setup VM

Here you want to define your host name (this will later look like yourhostname.cloudapp.net), a user name, password and the “Pricing Tier” (A0 Basic should be sufficient). Finally hit “Create“.

Open Ports for HTTP

After your Ubuntu VM is running, check the “Endpoints” settings. Here we want to add a rule for the HTTP traffic. Just hit “Add“, enter a name and set the ports to 80.
Azure NGINX Setup HTTP Port Endpoint

Login to your VM

Login to your VM is easy done with the very popular PuTTY tool. Just download the executable, add your previous defined host name and hit “Open“.
Azure VM Login Putty Download

Azure VM Login Putty

Next you need to enter the username and password which we defined before.

Install Nginx

After successfully logged in, we want to update the system:

$ sudo apt-get update

When all updates are installed, we install Nginx:

$ sudo apt-get install nginx -y

And after Nginx is installed, just start it with the following command:

$ sudo service nginx start

See the result

If Nginx is up and running, open a browser and navigate to your hostname + .cloudapp.net and see the default Nginx website:

Azure NGINX Ubuntu Result

You may also like...