Installing Nginx on cPanel / WHM Server

Nginx  is a  open source powerful web server which can handle millions of visitors. Nginx setup in reverse  will boost up cPanel/WHM Server. cPanel does not officially support nginx yet but we can set up  nginx on cPanel using NginxCP installation script , which provide good performance with cPanel Servers because

Nginx setup in reverse proxy support static contents like css, images, swf file , javascript etc and forward the remaining dynamic requests to apache web server, that the process called  as Nginx reverse proxy and Nginx behaves like front end server.

 

Benefits of Nginx on cPanel & WHM :

  • Boost up server performance with Gzip compression.
  • Plugin Integrated with cPanel/WHM Service Monitor.
  • Nginx Admin help to manage Nginx directly from WHM .
  • Support of PHP Rewrite .
  • Selection of service Nginx or Apache on domain basis.
  • Nginx pass trusted web requests , this will protect from common attacks .

 

Steps to install Nginx Admin :

Access the server through SSH with root account and get terminal command line and go into the directory through below command .

 cd /usr/local/src

Download nginxadmin package through below command .

wget http://nginxcp.com/latest/nginxadmin.tar

Extract  the nginxadmin.tar in the same path .

tar xf nginxadmin.tar

After extract the publicnginx folder will be create in the same path and go to this directory.

cd publicnginx

Now run the nginx installer through below command.

./nginxinstaller install

 

If you got the error like “access key doesn’t exist,”  then you need to create access key on cPanel / WHM Server ,  Follow below steps to configure access key through Control panel through  WHM Login.

Home >> Clusters >> Remote Access Key  >> Generate New Key

cpanel_remote_access_key

After Generate New key , now you can run again installer as above.

Now after successful run the installer script , the output will be look like below.

Welcome to the Nginx Admin installer......Starting Install

Please Wait .......

Generating vhosts...

Installing WHM interface...
…
…
****************************************************
*               Installation Complete              *
*run /etc/init.d/httpd restart to start Nginx Admin*
****************************************************

Restart nginx  with apache service .

For CentOS 7 , RHEL 7 or Cloud Linux 7 version :

systemctl restart httpd

Here i have run the status of httpd , i have got below output of the status of apache.

root@server [~]# systemctl status httpd
● httpd.service - Apache webserver managed by cPanel EasyApache
 Loaded: loaded (/etc/systemd/system/httpd.service; enabled; vendor preset: di sabled)
 Active: active (running) since Mon 2016-02-01 09:45:21 UTC; 4min 20s ago
 Process: 32541 ExecStart=/usr/local/cpanel/scripts/restartsrv_httpd --no-verbo se (code=exited, status=0/SUCCESS)
 Main PID: 26203 (code=exited, status=0/SUCCESS)
 CGroup: /system.slice/httpd.service
 ├─32551 /usr/local/apache/bin/httpd -k start
 ├─32554 nginx: master process /usr/local/sbin/nginx -c /etc/nginx/...
 ├─32555 nginx: worker process
 ├─32556 nginx: worker process
 ├─32557 nginx: worker process
 ├─32558 nginx: worker process
 ├─32559 nginx: cache manager process
 ├─32561 /usr/local/cpanel/3rdparty/bin/perl /usr/local/cpanel/bin/...
 ├─32562 /usr/local/apache/bin/httpd -k start
 ├─32563 /usr/local/apache/bin/httpd -k start
 ├─32564 /usr/local/apache/bin/httpd -k start
 ├─32565 /usr/local/apache/bin/httpd -k start
 └─32566 /usr/local/apache/bin/httpd -k start

Feb 01 09:45:20 server.XXXXX systemd[1]: Starting Apache webserver manage....
Feb 01 09:45:21 server.XXXXX restartsrv_httpd[32541]: Starting nginx daemo...
Feb 01 09:45:21 server.XXXXX systemd[1]: Started Apache webserver managed....
Hint: Some lines were ellipsized, use -l to show in full.

For CentOS , RHEL 5,6 version :

/etc/init.d/httpd restart

 

After installation you can check and manage Nginx Admin plugin . You can restart Nginx as well check login and configuration file from there.

nginx_cpanel_nginxadmin

 

About Sachin G

I am a professional freelance contributor and founder of tech transit. Love to write and lover of education, culture, and community. I have been using it, setting, supporting, and maintaining it since 2009.Linux rocks!

Have any Question or Comment?

2 comments on “Installing Nginx on cPanel / WHM Server

I’m as you could probably teach a class concerning how to produce
a great blog. This is fantastic! I need to say, what really got me was your
design. You understand how to make your blog not just a rant about an issue.
Youve made it possible for individuals to connect.
Healthy, because not too many individuals know what
theyre doing.

Reply
Ariadne

This process certainly helped me a lot. Easy to do.

Reply

Leave a Reply

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