Compared to Apache Nginx is a light-weight high performance web server. This makes it interesting to install the software on a VPS. Unfortunately CentOS 6 does not support Nginx out-of-the-box. This article works for CentOS 5 and 6.
Nginx repository
The previous version of this article relied on the Epel version of Nginx. EPEL stands for Extra Package for Enterprise Linux. This repository also contains Nginx and allows easy installation. Unfortunately this repository does not contain the most recent version of Nginx. Instead we are going to us the Nginx repository. Create the file /etc/yum.repos.d/nginx.repo and enter the following configuration:
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
Save the file and run the following command to install Nginx:
yum install nginx -y
Start nginx
Starting nginx is no different than a normal CentOS service:
service nginx start
To start nginx automatically when booting the server use the following command:
chkconfig nginx on
Congratulations! You have succesfully installed Nginx on your server.