How to install NginxCP on CloudLinux (cPanel)
Update: NginxCP is has been abandoned. Have a look instead at CPnginx.
While working with cPanel on CentOS and RedHat over the years I’ve read good things about Cloudlinux. However, I never played around with it and decided that this week I would take a look. NginxCP is a very common solution for admins looking to get the most throughput from web apps running on cPanel based web servers. This is achieved by reducing the demand on Apache by allowing Nginx to take care of static file serving. This is a quick guide for installing NginxCP on CloudLinux. Please note that NginxCP does not officially support CloudLinux but due to the identical nature of Cloudlinux to CentOS – except for a few RPMs – it works pretty well in most cases.
I you already have Cloudlinux and cPanel installed, please skip to the install subheading below. In my case, I started with CentOS 6.5 and followed the instructions here to convert to Cloudlinux. Next, was the cPanel install which you can follow the 3 commands listed here. After which, I imported a cPanel backup from a CentOS (w/ cPanel) server which powers about 40 websites, just to ensure I could properly test that everything worked. Also see: Nginx tuning tips: TLS/SSL HTTPS – Improved TTFB/latency.
Installing NginxCP on cPanel with CloudLinux
With Cloudlinux and cPanel already installed, you can now install NginxCP using the following commands:
mkdir /home/nginx cd /home/nginx wget http://nginxcp.com/latest/nginxadmin.tar tar xf nginxadmin.tar cd publicnginx ./nginxinstaller install
Done! Simply restart Apache then test your websites (Restarting Apache will also restart Nginx):
service httpd restart
If it helps, here’s a copy of the commands:
yum update yum install wget wget http://repo.cloudlinux.com/cloudlinux/sources/cln/cldeploy sh cldeploy -k <your cloudlinux key here> reboot vi /etc/selinux/config chkconfig iptables off service iptables stop yum update yum install perl cd /home wget -N http://httpupdate.cpanel.net/latest sh latest mkdir /home/nginx cd /home/nginx/ wget http://nginxcp.com/latest/nginxadmin.tar tar xf nginxadmin.tar cd publicnginx ./nginxinstaller install service httpd restart
Disclaimer: Do not attempt this install on a production server. Use the above info at your own risk! After testing on a development server, make a full backup of the live server before attempting. The above NginxCP setup worked with vanilla install of cPanel and Cloudlinux. There’s no CageFS, CSF security tools and/or other useful (some useless) bloat that may break your install. It you encounter errors, review any 3rd party features/add-ons. Feel free to post below. Enjoy!