This tutorial will describe how to compile and install Nginx on linux with different configuration options.
First of all you need the download the latest stable version of Nginx from the URL (http://nginx.org/download/nginx-0.8.54.tar.gz). Then put the compressed file into the directory /usr/local/src/. Untar the file. Login as root user. Now follow the below steps:
STEP 1: cd nginx-0.8.54
STEP 2: ./configure
STEP 3: make
STEP 4: make install
By default, Nginx will be installed in /usr/local/nginx directory. /usr/local/nginx/sbin will contain the standalone Nginx application. The default installation directory can be changed with the compile time options. Below is an example of compile time options:
(This is a single line:)
–prefix=/usr/local/myinstall (Defines the installation directory)
–sbin-path=/usr/local/myinstall/nginx (Defines the executable nginx path)
–conf-path=/usr/local/myinstall/nginx.conf (Defines the path to nginx conf file)
–pid-path=/usr/local/myinstall/nginx.pid (Defines the path to pid file)
The above procedure installs the minimal version of Nginx i.e. it contains only the basic services and modules. If you need to use any third party modules then you need to specify the module at compile time. Below is the option to compile Nginx with 3rd party modules.
By default Nginx compilation does not include SSL module. So if you want to use SSL module you need to specify it at compile time with the below option:
This will enable Nginx to handle https requests.
You can always check the options available with the Nginx by using the below command: