Wednesday, June 12, 2013

Howto install nginx webserver in Debian

Nginx (pronounced “engine x”) is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. Written by Igor Sysoev in 2005, Nginx now hosts between 1% and 4% of all domains worldwide .Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption.


Basic HTTP features:


Handling of static files, index files, and autoindexing; open file descriptor cache;

Accelerated reverse proxying without caching; simple load balancing and fault tolerance;

Accelerated support without caching of remote FastCGI servers; simple load balancing and fault tolerance;

Modular architecture. Filters include gzipping, byte ranges, chunked responses, XSLT, and SSI. Multiple SSI inclusions within a single page can be processed in parallel if they are handled by FastCGI or proxied servers.

SSL and TLS SNI support.


Mail proxy server features:


User redirection to IMAP/POP3 backend using an external HTTP authentication server;

User authentication using an external HTTP authentication server and connection redirection to internal SMTP backend;

Authentication methods:

POP3: USER/PASS, APOP, AUTH LOGIN/PLAIN/CRAM-MD5;

IMAP: LOGIN, AUTH LOGIN/PLAIN/CRAM-MD5;

SMTP: AUTH LOGIN/PLAIN/CRAM-MD5;

SSL support;

STARTTLS and STLS support


Other HTTP features:


name- and IP-based virtual servers;

keep-alive and pipelined connections support;

flexible configuration;

reconfiguration and online upgrade without interruption of the client processing;

access log formats, bufferred log writing, and quick log rotation;

4xx-5xx error codes redirection;

rewrite module;

access control based on client IP address and HTTP Basic authentication;

PUT, DELETE, MKCOL, COPY and MOVE methods;

FLV streaming;

speed limitation;

limitation of simultaneous connections or requests from one address.


Experimental features:


embedded perl.


At the time of writing, the latest stable version is 0.6.35 and if you need more information check nginx main site http://nginx.net/


Preparing your system


First letus install some required packages


sudo aptitude install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev


Download latest stable version from here or using the following command


#wget http://sysoev.ru/nginx/nginx-0.6.35.tar.gz


Now you have nginx-0.6.35.tar.gz file unpack this file using the following command


#tar -zvxf nginx-0.6.35.tar.gz


cd nginx-0.6.35


Now you need to start installation so for this you need to check what options you want to use from here http://wiki.codemongers.com/NginxInstallOptions


In this installation we are using only two options –sbin-path and –with-http_ssl_module


./configure –sbin-path=/usr/local/sbin –with-http_ssl_module


After completion of installation you should see similar to the following details which are very useful make a note of them


nginx path prefix: “/usr/local/nginx”

nginx binary file: “/usr/local/sbin”

nginx configuration file: “/usr/local/nginx/conf/nginx.conf”


Start Nginx using the following command


#/usr/local/sbin/nginx


Now you can navigate your web browser and point the follow url


http://yourserverip


You should see welcome to nginx message


If you want nginx startup script download from here in to the /etc/init.d directory


Now you need to make scipt executable


#chmod +x /etc/init.d/nginx


Now we have the base script prepared, we need to add it to the default run levels using the following command


#/usr/sbin/update-rc.d -f nginx defaults


From now you can use the following commands to start,stop and restart nginx.By default nginx will not provide this scripts


#/etc/init.d/nginx start


# /etc/init.d/nginx stop


# /etc/init.d/nginx restart



Howto install nginx webserver in Debian

No comments:

Post a Comment