Install Nginx Using Yum Command on CentOS 6 / RHEL

 

Now Nginx can be installed via yum on CentOS / REHL. Before you install it via yum, you will have to add necessary repo. You can follow the steps to add repo for Nginx:

WHMCS Complete Billing and Support

For CentOS 6.x users:

[root@server ~]# cd /tmp
[root@server ~]# wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
[root@server ~]# rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm

For RHEL 6.x users:

[root@server ~]# cd /tmp
[root@server ~]# wget http://nginx.org/packages/rhel/6/noarch/RPMS/nginx-release-rhel-6-0.el6.ngx.noarch.rpm
[root@server ~]# rpm -ivh nginx-release-rhel-6-0.el6.ngx.noarch.rpm

Now, you can install nginx web server using yum:

[root@server ~]# yum install nginx

Once nginx is installed successfully, turn on service using chkconfig:

[root@server ~]# chkconfig nginx on

Following are the commands to start / restart / stop nginx web server:

[root@server ~]# service nginx start
[root@server ~]# service nginx restart
[root@server ~]# service nginx stop
[root@server ~]# service nginx status
[root@server ~]# service nginx reload

Now, you can edit nginx configuration file as per your need. The configuration file is available at following location:

/etc/nginx/nginx.conf

Posted in Nginx.

Leave a Reply

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