info home general windows unix linux debian mac os apache nginx iphone

Recent Articles

How to rename multiple files in Unix or Linux

Convert docx to doc in Mac OS X Snow Leopard or Leopard

HISTORY shell variable management in Unix/Linux

How to eject CD/DVD from your MacBook or iMac

Play Prince of Persia on Ubuntu Linux using DOSBox

Tags

Installing Nginx web server

Nginx web server

A few months back, I moved from Apache 2.2 to Nginx, a powerful lightweight webserver. Apache was taking up too RAM and slowing down at times.

I wanted to try Lighttpd, but decided against it because of its known memory leak problem. So I decided to give Nginx a try and I'm very happy at this transition. At the time of writing, the latest stable version of Nginx is 0.6.34.

UPDATE: Latest stable version is 0.7.61.

Nginx serves two purposes:

  1. It takes all the traffic load, particularly HTTP requests for static web content.
  2. It works as a load balancer and forwards dynamic requests to Apache, which may run on the same machine or another machine.

Installation of Nginx

Ubuntu or Debian

To install Nginx in Ubuntu or Debian, all you have to do is:

sudo aptitude update
sudo aptitude install nginx

By default, Nginx installs in /etc/nginx.

Installation from source

If you prefer to install Nginx from source, download it.

These commands should install Nginx in /usr/local/nginx

You may change the configure script according to your preferences.
./configure
make
make install

RedHat or CentOS

If you use RedHat Linux, run this:

sudo yum install nginx

Next: Configuring Nginx »

Last Update: July 2009