Software >> Services >> HTTP Server >> nginx >> Getting started with nginx in linux

## Prepare to Install nginx in CentOS or RHEL

To add NGINX yum repository, create a file named /etc/yum.repos.d/nginx.repo and paste one of the configurations below:

CentOS:

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


RHEL:

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



## Install

yum install -y nginx


## enable/start service

systemctl enable nginx
systemctl start nginx



## Config files

main: /etc/nginx/nginx.conf
includes: /etc/nginx/conf.d/*.conf


## Document Root & Index document

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;