To install NGinx on cPanel servers we recommend you use the product NGinxCP available at http://www.nginxcp.com
This is a free plugin for cPanel.
- Login to WHM on your server
- Go to WHM -> Clusters -> Remote Access Key. Click 'Generate a new access key'
- See: http://www.nginxcp.com/installation-instruction/ for the latest installation instructions. It is very simple and you need to login to your server via SSH before you can complete the following commands:
cd /usr/local/src
wget http://nginxcp.com/latest/nginxadmin.tar
tar xf nginxadmin.tar
cd publicnginx
./nginxinstaller install
mv /scripts/after_apache_make_install /scripts/posteasyapache
yum install tmpwatch -y
crontab -e
copy this line: 0 */1 * * * /usr/sbin/tmpwatch -am 1 /tmp/nginx_client
scroll to the bottom of the crontab entries so the cursor is on a blank line, then right click to paste that line in
Press CTRL O to save the file
Press CTRL X to exit
- Now login to WHM again and go to Plugins. You will now see the Nginx Plugin. You should now be able to test to see if the changes have worked.
Note: If you have no active accounts Nginx will not start properly. So you should create an account in WHM -> Account Functions -> Create a New Account then go to WHM -> Plugins -> Nginx Admin and click 'Restart Nginx'
There is an article on common issues here: http://www.nginxcp.com/forums/Thread-nginxcp-faq-read-before-you-post - Now go to WHM -> Plugins -> ConfigServer Security&Firewall
Go to the ldf - Login Failure Daemon section and there is a drop down box which has csf.ignore selected. Change this to: csf.pignore then click 'Edit'
Add the lines:
exe:/usr/sbin/nginx
exe:/usr/local/sbin/nginx
Click 'Change'
Click 'Restart LFD'
This ensures you are not notified about nginx running constantly by the system. - If you are getting random 'Internal server errors' accessing your site, you will need to go to WHM -> Plugins -> NGinx Admin
Click on 'Configuration Editor'
Change the line:
worker_processes auto;
to
worker_processes 5;
Check 'Restart Nginx' and click 'Update'