Intro To Nginx – Webserver For Modern Web
Intro To Nginx
Whenever we talk about webserver’s only one name came to our mind and that is the good old apache web server which is an open source HTTP web server used to serve web content. In this intro to Nginx, we will learn about a modern web server called Nginx and why it is superior to Apache web server. Let’s start with the basics first, to understand Nginx we must know what is a web server and how it works. Consider you want to open a website lets say “www.google.com”, you will open your browser and type the URL into the browser and your browser will show you the site but there are a series of steps involved in this whole process which are as follows.
Step 1 – You type “www.google.com” in your browser and press enter, an HTTP(Hyper Text Transfer Protocol) GET request was initiated by your browser which contains the URL you want to open and certain other parameters.
Step 2 – This request will leave your local network and traverse the internet and find one of the computers which are assigned to serve the Google homepage.
Step 4 – Finally this response will follow the same route until it reaches your computer and on receiving this response request your browser will show you the contents of the webpage.
In this whole process, the computer which was assigned with the task of serving the Google’s home page is called a web server. A web server can be any computer which holds the capability to accept HTTP requests and sending HTTP responses.
What is Nginx?
Nginx is a modern web server which was created by Igor Sysoev in 2002 in Russia and was officially released in the year 2004. Nginx is pronounced as eNginEx. Nginx is a powerful web server which can be used as a web server, a proxy server, a mail server. According to Netcraft which is a website that collects statistical pieces of information, Nginx has served more than 28% of the busiest websites in February 2017.
Features Of Nginx
Below is an image which is taken from Nginx.com which shows the results of a survey.
1. Speed -: Nginx is very efficient and serves content with lightning fast speed as we all know how much important is speed today and after all who loves a slow loading webpage. According to a survey, people will not wait more than two seconds to see a fully loaded page.Nginx is capable of providing that speed, I personally have seen the difference when I switched from Apache to Nginx a year ago my page loading speed was improved from 7s to only 2.5s and Google also consider page speed a very important factor when showing results in organic search.Here is a tool to test your website’s speed.
2. Load Balancing -: The main function or feature of Nginx is to serve web pages but Nginx can also be used as a load balancer.Load balancing is very important in today’s internet scenario.Suppose we are using two to three web servers for our huge website which receives a lot of traffic we can plug in Nginx as a load balancer which helps to distribute traffic load on these two or more web servers so that if one server crashes system will still run efficiently.
4.Reverse Proxy Server -: Nginx can also be used as a reverse proxy server. A reverse proxy server which retrieves resources on behalf of a client and interacts with all the internal servers to fetch the requested data and respond back to the client as if the data was returned back from the original server only.A reverse proxy is used to hide the existence or characteristics of the original server or from where the data is actually being served.
So in this Intro To Nginx, we learned the basics of Nginx and why it is better than Apache Web server In later posts we will install Nginx stack on our EC2 Instance and see it in action.
In case you don’t know how to set up EC2 check this post.
Have a good day!