Tips / Nginx

How to install Nginx on CentOS 6 / RHEL

Installing Nginx on CentOS / RHEL is pretty simple, because for this Linux distribution Nginx provide us the binary packages ready to be downloaded and installed with package manager Yum. Of course you can also install nginx on centos using the source package in tar.gz format, but today we will focus on yum installation.

Get the Nginx repo for CentOS 6 or RHEL 6 from Nginx page:

Download the repo:


or if you are usign RHEL 6:


Install the rpm:

rpm -ivh nginx-release-rhel-6-0.el6.ngx.noarch.rpm

Install the nginx web server:

yum install nginx

Turn on nginx service:

service nginx start

Add Nginx to boot process:

chkconfig nginx on

All done! Now you have to configure nginx editing /etc/nginx/nginx.conf and /etc/nginx/conf.d/default.conf , after every time you configure the webserver, you’ll need to reload the configuration using:

service nginx reload

General explanation of Nginx Configuration files

  1. Default configuration directory: /etc/nginx/
  2. Default SSL and vhost config directory: /etc/nginx/conf.d/
  3. Default log file directory: /var/log/nginx/
  4. Default document root directory: /usr/share/nginx/html
  5. Default configuration file: /etc/nginx/nginx.conf
  6. Default server access log file: /var/log/nginx/access.log
  7. Default server access log file: /var/log/nginx/error.log

If you think there is something missing in this Nginx tutorial, please submit your feedback, we’ll be glad to update the article with more useful information.

Popular search terms:

  • nginx rhel 6 rpm
  • centos 6 nginx
  • how to install nginx on centos
  • how to install nginx on linux

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking

  • Ninju Bohra

    When using RHEL 6 you need to use the following instruction:

    rpm -ivh nginx-release-rhel-6-0.el6.ngx.noarch.rpm

  • admin

    Fixed, thanks!