Setup Nginx and Ubuntu on Azure
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:
- Install and Setup Nginx on Azure with a Ubuntu VM
- PHP with Configuration
- MySQL
- Setup WordPress
- 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.
Next click “Create” and you will see the following menu:
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.
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“.
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: