Nginx

Nginx (pronounced engine-x) is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server.Nginx now hosts nearly 12.18% (22.2M) of active sites across all domains.

Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. Unlike traditional servers, Nginx doesn’t rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but more importantly, predictable amounts of memory under load.

Even if you don’t expect to handle thousands of simultaneous requests, you can still benefit from Nginx’s high-performance and small memory footprint. Nginx scales in all directions: from the smallest VPS all the way up to clusters of servers.

Steps to install Nginx

Follow the below steps to install nginx on the (cPanel) server.

cd /usr/local/src
wget http://nginxcp.com/latest/nginxadmin.tar
tar xf nginxadmin.tar
cd publicnginx
./nginxinstaller install

Now Nginx will be installed on the server, along with a cPanel plugin “NGinx Admin”

Probable Errors

1. If you get the following error while installing nginx,

Please upgrade cPanel to version 11.25 or above

It is because, the nginx installation script “nginxinstaller” was setup to check if the cpanel version is 11.25 or not. It will produce the above specified error if the cpanel version is not 11.25.

To resolve this, open “nginxinstaller” script in the vi editor and change the cpanel version specified in the script to the corresponding one in the server. Save this and try again.

2. It may produce another error related to python version:

File "/usr/lib/python2.4/site-packages/PyYAML-3.10-py2.4-linux-

i686.egg/yaml/__init__.py”, line 26

SyntaxError: 'yield' not allowed in a 'try' block with a 'finally' clause

Check the latest python package available with the OS repo. If it is version 2.4, then do not update it manullay, which may cause conflicts to many other applications.

Instead, you can install python 2.5 or later versions in any other location like /usr/local. Make sure that you have given the prefix while installing the new version as given below:

wget http://www.python.org/ftp/python/2.6/Python-2.6.tgz                                                
tar -zxf Python-2.6.tgz                                                                                                                                                                                    
cd Python-2.6/                                                                                                                                                                                            
./configure --prefix=/usr/local                                                                                                                                                                   
make                                                                                                    
make install 

Then copy /bin/env to /usr/local/bin/env for properly parse python scripts:

cp /bin/env /usr/local/bin/env

Now, you can continue with the nginx installation:

./nginxinstaller install

Let us know if you face any problems.