Feb 232009

Sponsored Link

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:
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;
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


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


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

Sponsored Link

 Posted by at 12:05 am

  7 Responses to “Howto install nginx webserver in Debian”

  1. thanks for your acticles , but i find the link is broken.
    http://www.debianadmin.com/images/ngix, cant download the
    nginx startup script.

  2. @I have updated the link now

  3. I tried nginx and liked it, but I wanted to run apache with php5 support, for myphpadmin.

  4. why the package is not installed from debian repositories? It’s configure with ssl support, too


  5. Thanks! I have nginx installed on my server! In 10 minutes…

  6. For those of you that needs a source install, I’ve come up with a script to automatically download, configure, build and install Nginx from source :)

    All scripts and config files are stored at gist.github.com.

    Take a look, I’d appreciate your feedback.


  7. How to install pureftpd, mysql on nginx+debian?


 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>