Install nginx on CentOS 6

If you want to have the latest version of nginx on your CentOS system the easiest way is to use the official yum repository from the nginx program. The version contained in the EPEL repository is quite old.

Download the repo RPM from http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm and install it using rpm -i <packagename>. Then run the command ‘yum install nginx’.

Or create the repository manual.

Create a new repository file:

vi /etc/yum.repos/nginx.repo

copy the yum repository information into it and save it:

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

now install nginx:

yum install nginx

If you’re looking for sample configuration files you should have a look at the nginx wiki page wiki.nginx.org there are quite a lot of good examples.

3 thoughts on “Install nginx on CentOS 6

  1. Pingback: nginx install on centos | web technologist

  2. farrukh

    Above path is not correct. here is correct path to create .rep file

    #CentOS 6.3
    #vi /etc/yum.repos.d/nginx.repo
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=0
    enabled=1

    #yum install nginx

    Reply
    1. Banym Post author

      Hi thx for the hint.

      Now there is repo rpm available, too. Just download it from nginx project page install it with rpm -i and run yum install nginx.

      Regards,

      Dominik

      Reply

Leave a Reply

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