Showing posts with label Web Servers. Show all posts
Showing posts with label Web Servers. Show all posts

Sunday, July 10, 2011

Nginx Installation

I showed you the powerfulness of nginx in my previous post. Now I want to let you know about the installation and configuration of nginx.

For installing nginx in your ubuntu or other GNOME environments, type the following command in the terminal.

sudo apt-get install nginx

You can install any packages by typing in terminal in this format. If you want to remove any packages use the command,

sudo apt-get autoremove <package_name>

After the installation, check whether the server works. Open your Mozilla Firefox and type 127.0.0.1 as the url. If it shows the message “it works”, Apache is already running on your system. You need to stop Apache. Type the following command to view the running processes,

sudo ps ax

It’s just like the task manager in windows. You can stop the processes by the command,

sudo killall -9 <process_name>

After stopping Apache you need to start the nginx server.

sudo /etc/init.d/nginx restart

Then open Mozilla and type the127.0.0.1 and you can view the nginx welcome message which is the default index page of nginx. You can edit this index.html file. Type “cd ..” a number of times to reach the root and enter into /var/www in the file system where you can see a nginx-default folder. Inside that folder you can see the index.html and edit that file by supervisor user. To get the supervisor power, enter “su” in the terminal.

To view the configuration file you can go to /etc/nginx in file system and can see the nginx.conf file.

I hope this will be a useful article for those who are not familiar with the nginx web server.

Thanks

AJAY

Nginx vs Apache

In this post I want to explain how Nginx overcomes Apache.

Even Apache is the most popular and widely used web server in the world; Nginx is the main challenger to Apache. Apache can only process 100 http requests per second and is not efficient in websites that face heavy traffic. Nginx can process thousands of http requests per second and can easily handle more than 500 million requests per day.

Here I want to show you some statistics which are shared by Joe Williams, an open source supporter.

The image given shows the reply rate of both servers. The reply rate is the rate at which the servers reply to the http requests.


 It is clear that Nginx takes less reply time than Apache that makes the nginx server a fast one. Another statistics is about the network I/O overhead. Apache uses more bandwidth to handle the same number of requests that are handled by the nginx.


 Another interesting statistics is on the response time. Look at the image given below.


Apache has higher response time and it varies upon the increase of number of http requests. But nginx shows a constant 0.4ms response time throughout the varying number of http requests.

Nginx also overcomes Apache in the case of load on the CPU.

In my next post I will explain how to install this powerful web server in the ubuntu systems.

Thanks

AJAY

Nginx - An Introduction

We all know, to run a web application we need a server. The web application must be processed on a powerful system. The users access the application through the browsers. Browsers send http requests to the port of the web application. The web server receives and processes the request and sends the response.

The most popular web server software is Apache server which is a open source project. Websites like Wikipedia, Google, Facebook etc handles huge amount of traffic. So they need powerful web servers. Apache can handle around 100 http requests per second only. I introduce you another powerful web server, nginx, also an open source project. It can handle thousands of http requests per second.

It runs on Unix, Linux, BSD variants, Mac OS X, Solaris, and Microsoft Windows. nginx is a lightweight, high-performance Web server/reverse proxy and e-mail (IMAP/POP3) proxy. It is licensed under a BSD-like license. BSD licenses allow the open source tools to edit the source code and gives authority to hide the modifications in the source code.

It is written in C and first released on 4th October 2004. It’s developed by Igor Sysoev. According to Netcraft's May 2011 Web Server Survey, nginx was found to be the third most widely used web server across all domains (7.50% of surveyed sites) and the fourth most widely used web server for all “active” sites (8.23% of surveyed sites).

Originally, nginx was developed to fill the needs of various websites run by Rambler, for which it was serving 500 million requests per day as of September 2008!! Nginx uses an asynchronous event-driven approach to handling requests which provides more predictable performance under load, in contrast to the Apache HTTP server model that uses a threaded or process-oriented approach to handling requests.

I will post more about nginx soon

Thanks

AJAY