Compile Nginx from source

Probably you are setting a virtual host on one of the cloud providers. Read here  few references on cloud computing provides

Configure Nginx with extra modules

The first step is to figure out which modules of Nginx you will be using. Read Nginx documentation and download all dependencies.

For example, I will download ngx_cache_purge from git and some few other Nginx modules

git clone https://github.com/phusion/passenger_apt_automation.git
git clone https://github.com/FRiCKLE/ngx_cache_purge.git
git clone https://github.com/openssl/openssl.git

Depending on which modules you will use probably you will need to install some libraries (depending on your operating system) as shown below.

 apt-get install libxml2-dev
 apt-get install libxslt-dev
 apt-get install libgd2-xpm libgd2-xpm-dev
./configure --sbin-path=/usr/sbin/nginx --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-openssl=/usr/local/src/openssl-1.0.1j --add-module=/usr/local/src/passenger_apt_automation/debian_specs/nginx/modules/nginx-auth-pam --add-module=/usr/local/src/passenger_apt_automation/debian_specs/nginx/modules/nginx-echo --add-module=/usr/local/src/passenger_apt_automation/debian_specs/nginx/modules/nginx-upstream-fair --add-module=/usr/local/src/passenger_apt_automation/debian_specs/nginx/modules/nginx-dav-ext-module --add-module=/usr/local/src/ngx_cache_purge

Configure

The output of this command may be similar to:

 Configuration summary
 + using system PCRE library
 + using OpenSSL library: /usr/local/src/openssl-1.0.1j
 + md5: using OpenSSL library
 + sha1: using OpenSSL library
 + using system zlib library
 nginx http scgi temporary files: "/var/lib/nginx/scgi"

Build Nginx and install

If the configure step was successfully finished, then you can try to build and install Nginx by following commands.

 make
 make install