Nginx is an open source, fast, light weight and highly customable web server that is similar to Apache. Unfortunately configuring and setting him up is not that easy compared to Apache. nginx is both web server and reverse proxy server.
Modules can not be loaded later via a config file like Apache modules, they must be compiled into the Nginx binary.
If you have centos and want to install nginx the easy way, feel free to follow: How to install nginx on centos
Dependencies
There are certain libraries required in order for nginx to compile.
For Ubuntu, Mint, or Debian based distributions
apt-get install libpcre3-dev libssl-dev
For Fedora, Centos, or Red Hat based distributions
yum install pcre-devel zlib-devel openssl-devel
Download nginx
You can go to nginx to get the lastest stable version
http://nginx.org/en/download.html
As the time I’m writing, the lastest stable version is 1.4.1
wget http://nginx.org/download/nginx-1.4.1.tar.gz
Extract the archive:
tar xvzf nginx-1.4.1.tar.gz
Go to nginx directory
cd nginx-1.4.1
Compile nginx
This is where we can choose what we want to compile and install, and where the build process is determined based on what libraries you have, what architecture processor and the like.
To identify list of all the configuration options
./configure --help
By default, Nginx will be installed in /usr/local/nginx. You may change this and other options with the compile-time options.
Make and Install
Lets keep thing simple here, i will use default install location with ssl module
./configure --sbin-path=/usr/local/sbin --with-http_ssl_module # make # make install
Start Nginx
For Ubuntu, Mint, or Debian based distributions
# /usr/local/sbin/nginx
For Fedora, Centos, or Red Hat based distributions
# chkconfig nginx on # service nginx start