cPanel is most popular hosting control panel. By default cPanel do not support Nginx and uses Apache. Nginx is supposed to be much faster and lighter compared to Apache. So, how can we add Nginx on a cPanel server.
Nginx is small, fast and light weight alternative of Apache. But Nginx also needs few tweaking to optimize it. In this tutorial we are going to learn three tweaks to optimize a Nginx server and improve its performance.
Nginx is a fast and low memory usage web / HTTP server software. Nginx is considered to be faster compared to Apache web server. There are lots of paid and free hosting control panel like cPanel available for Apache server, but there are only few Nginx supported hosting control. read more
In this tutorial, I will explain how to install Nginx on a CentOS server / VPS. This is very easy and will not take more than 5 minutes.
Login to your server via SSH and as root.
If you have already installed Apache and is running, stop Apache.
service httpd stop
Create nginx repo file.
Edit nginx repo file.
And add following code. Save the file.
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
yum install nginx
service nginx start
Make nginx auto start on server reboot.
sudo chkconfig nginx on
This is the default folder / directory of Nginx server. You should upload your website files in this directory.