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.
Before starting installation of Nginx, make sure you have installed PHP and MySQL
How to install PHP
How to install MySQL
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
Default Web Directory
This is the default folder / directory of Nginx server. You should upload your website files in this directory.