Installing Nginx on an Azure Linux Ubuntu 16.04 VM

In this post we will see how to install nginx on a Ubuntu Linux 16.04 LTS virtual machine on Azure. This is one of the best HTTP servers and reverse proxy, and also an IMAP/POP3 proxy. It is open source.

Let’s assume that we have deployed the Linux virtual machine on a basic state. Otherwise, as summary, the steps are:

– Create a virtual machine from the gallery with Ubuntu 16.04. You can see my post about creating Linux VM.
– Change the default ssh port. You have instructions to do it in Azure in my post about it.
– Upgrading the system, connecting to a console session and running:

sudo apt-get update
sudo apt-get upgrade

This step is always recommended before installing a package (except production servers with previous production packages, that you have to consider whether or not it is convenient).

As we will install an HTTP server, if you have got a previous http server like Apache, you have to uninstall it to prevent conflicts.

Once the machine is ready to install nginx, from the ssh console run:

sudo apt-get install nginx

And finally we start the nginx service with:

sudo systemctl start nginx

Check that the service is active with:

sudo service nginx status

It provides service information that will be similar to the following screen:

20160505_Install_NGINX_Paso02

Now, we have installed nginx, with its default settings to port 80. If we go to the machine, trhought that port, the next page appears:

20160505_Install_NGINX_Paso03

For more information about nginx you can find it on this link.

Isaac Lázaro

gigaSACs is a website dedicated to writing about Cloud Computing and programming, the main subjects are Azure, .NET, SQL Server, Wintel, Linux, JAVA, and general technology.