CentosFedoraLinuxNginxWebserver

How to Install Nginx on CentOS / RHEL

Normally I install Nginx on CentOS / RHEL via the EPEL repo, however I have recently discovered the Nginx project has it’s own repo available. Note this will install a much newer Nginx version than the one available in the EPEL repo, follow the steps below to install Nginx on CentOS / RHEL.

Create the file /etc/yum.repo.d/nginx.repo and populate it with the following text (depending on your distro / version number).

Nginx CentOS 6 YUM Repo

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

Nginx CentOS 5 YUM Repo

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

Nginx RHEL 6 YUM Repo

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

Nginx RHEL 5 YUM Repo

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

Yum Install Nginx (CentOS / RHEL)

Next you can simply yum install the latest version of nginx using:

# yum install nginx

NOTE: if you are only running one website and your html files are at the default site location updating Nginx via yum will overwrite your website files with the default Nginx site files.

Related Articles

Leave a Reply

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

CAPTCHA


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button