How to install Nginx as reverse proxy on cPanel server

Introduction

The web-hosting control panels are loaded with the default web-server Apache. cPanel/WHM doesn’t have native support on Nginx web server. However, we can install and configure it many ways on a WHM server to increase the websites’ speed. That will also improve the server performance.

Why run Apache and Nginx together? Is there any advantage by using Nginx as reverse proxy in a cPanel server?

Both Apache and Nginx are powerful and effective web-servers. Apache is the topmost webserver since it was released in 2006 and Nginx is now using top websites. The reason for using Apache and Nginx together are clear, Apache’s power and Nginx’s speed.

By setting Nginx as reverse proxi, we can increase the websites speed and performance in the server. This is because, Nginx will take care of all static contents in the website such as CSS, images, SWF files, MP4 and more and Apache will manage the rest of requests (dynamic requests – php page).

This is known as Nginx reverse proxy setup. Nginx stand as front end servers with a powerful backend Apache server.

How to set up?

If you wish to install nginx as reverse proxy in a cPanel server then, follow this steps:

1, SSH to server as root.
2, Change the directory to “/usr/local/src”

# cd /usr/local/src

Download the latest nginxadmin package & Install

# wget http://nginxcp.com/latest/nginxadmin.tar 
# tar xf nginxadmin.tar
# cd publicnginx
# ./nginxinstaller install

In WHM, now Nginx Admin plugin will be available under plugins section. After installing make sure Nginx process is running on the server, You can chcek this by using the following command.

# ps aux | grep nginx

If it is not showing any process, then kill httpd and restart httpd

#killall -9 httpd
#/etc/init.d/httpd restart

Nginx Admin Uninstall instruction:

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

P.S. Make sure that the Nginx is running on port 80 and Apache on different port (like 8080). Also open the new port the server firewall.

That’s it!

Related
How/Steps to install Suhosin Patch(php extension) on Unix/Linux server
how to install/uninstall snoopy logger on Unix/Linux server
iftop installation on Unix/Linux server

Arunlal Ashok

Linux Server Administrator. I'm managing Linux servers since 2012. I started this blog to share and discuss my ideas. Any questions? Write to arun (@) crybit.com

You may also like...

10 Responses

  1. Pankaj says:

    Hello sir, I have installed Nginxcp in my cpanel VPS through this guide. DO I need page cache script like APC or eAccelerator etc and what should I do to make VPS more efficient.

    Thankyou

  2. Boki says:

    Hi… I would also like to know that.

  3. thelinuxfaq says:

    Hi,

    @Pankaj : You can go for CentOS server (VPS),

  4. berita hari ini says:

    install nginx as reverse proxy in my kloxo.. i have make some different.. but it works. thanks

  5. avinfam says:

    is nginx has conflict with cpanel ?

  6. Hafiz says:

    Tried to install in new cPanel server (66) and this error appears

    access key doesn’t exist
    go to WHM > Cluster/Remote Access > Setup Remote Access Key
    and click on the Generate New Key button

    Any ideas?

  1. January 23, 2014

    […] this also: How to install nginx as reverse proxy in a cPanel server how to install/uninstall snoopy logger on Unix/Linux server iftop installation on Unix/Linux […]

Leave a Reply

Your email address will not be published. Required fields are marked *