Nginx as a reverse proxy and web cache server in Microsoft Azure via Docker (part 1)

Nginx [pronounced engine x] is an HTTP and reverse proxy server, a mail proxy server and a generic TCP/UDP proxy server ,originally written by Igor Sysoev. It is lightweight and fast,free and open source.It s smart architecture is based in  asynchronous approach which is event-driven for handling requests.It ‘s designed for heavy traffic web sites with load balancing support as well as proxy support. Nginx first public release was in 2004.According to Netcraft’s March 2016 Web Server Survey Nginx  found to be the second most widely used web server across all active sites.

Picture1.jpg

In this blog post  we will see that it is very easy to deploy Nginx in Microsoft Azure and use it as a reverse proxy and web cache server.

In computer networks, a reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers. These resources are then returned to the client as though they originated from the proxy server itself. [Wikipedia]

2000px-Reverse_proxy_h2g2bob.svg.png

A web cache sits in between a client and an “origin server”, and saves copies of all the content it sees. If a client requests content that the cache has stored, it returns the content directly without contacting the origin server. This improves performance as the web cache is closer to the client, and more efficiently uses the application servers because they don’t have to do the work of generating pages from scratch each time.  [www.nginx.com]

After this small intro lets start deploying Nginx in Azure. We will create a Virtual Machine that will host Nginx. This process includes the following steps :

  • Sign in Azure portal
  • In a Resource group press the Add button.Search for nginx

nginxPortal.jpg

  • Select the 2nd line . The deployment of this item results in the following offerings being installed : Ubuntu Server 15.10 , Docker Engine VM and Nginx Container as published by Docker.
  • Press the create button and  start configuring the VM

nginx3.jpg

  • After the basic settings  chose the virtual machine size.This depends on our needs.In our example we use the A1 standard VM.
  • Leave the settings step with the default values and then  deploy the VM. We should wait a few minutes for the VM to be deployed.We make one small addition and then we are ready : Our resources except the VM include a network interface,a network security group and a public IP address.Select the public IP address resource and then Configuration.Add  a DNS name label :testnginx then  press Save.

testnginxPublicIP.jpg

Now we want to access our VM.It is a linux VM so we can access it via Putty.

putty1.jpg

Press open and then a console window appears.Enter  username and password and you are in!

END OF PART 1

Giorgos Basagiannis

I am a full stack engineer with broad technical skill set. I am passionate about developing high quality software that is scalable and easy to maintain. My main areas of interest include Microsoft Web & Cloud Technologies,JavaScript based frameworks,SharePoint and Office 365.

Leave a Reply

Your email address will not be published. Required fields are marked *