How to install Nginx in CentOS-7?

Nginx (pronounced “engine x”) is a free, open-source, high-performance HTTP server. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption. This tutorial shows how you can install Nginx on a CentOS 7 box.

Since Nginx is not available from the official CentOS repositories, the first and foremost thing we need to do is to enable additional repository for Nginx. We can create a new file to include the repository of the Nginx project as this,

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

Nginx can now be installed as,

sudo yum install nginx

Then we create the system startup links for nginx and start it:

systemctl enable nginx.service
systemctl start nginx.service
Share Button

Leave a comment

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