Install Nginx webserver on centos using YUM

On 6 Jun, 2012 in Linux with Comments
Install Nginx Webserver On Centos Using YUM

Here we will learn how to install Nginx in Centos using YUM and setup it as reverse proxy to APACHE

First we search for Nginx in our repo

yum search nginx

If Nginx is not available in our repo result for our command we will be as shown in the below figure.

Now we have to configure repository to Nginx install Nginx through YUM. Create a file ‘/etc/yum.repos.d/nginx.repo’ by using the below command

touch /etc/yum.repos.d/nginx.repo

Add the following content to the nginx.repo using VI editor or whichever comfortable

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

Replace “OS” with “centos”, depending on the distribution used, and “OSRELEASE” with “5” or “6”, for 5.x or 6.x versions, respectively.

baseurl=http://nginx.org/packages/centos/5/$basearch/

Now search for Nginx using “yum search nginx” command we can find Nginx is available in our repo

Start installing Nginx

Now Run the below command to start installing Nginx

yum install nginx

Result for the above command will be as shown in the below image.

Installation process will ask permission to download the file. the files we have to type y and return key to start the download and install

Nginx installation completed as shown in the above image and we can check the status of nginx web server by using the below command.

service nginx status

Know more about how to setup Nginx as reverse proxy for APACHE

Tags: , , ,