Nginx is high performance Web Sever software. As compared to Apache Server it is far more flexible, easy to configure and light in use. In this post we will see How to install and start Nginx on CentOS7 machine.

As per Web Survey from Netcraft in Dec 2017, Nginx is continually increasing its share in Web Server used across globe, although website are also increasingly but percentage share of Nginx is increasing and other Web Server which were leading from many years are coming down in percentage share.

SetUP

As said we are going to see to see Installation and starting process of Nginx HTTP Server on CentOS7 latest as of now in Jan 2018.

[root@sample ~]# uname  -rs
Linux 3.10.0-693.11.6.el7.x86_64
[root@sample ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)

</Installation of Nginx

As we know in CentOS machine, we use YUM to install package, which is easy and fast process to install Packages over machine in network. For Nginx we have to add epel repository on CentOS7 like below mentioned.

#yum install epel-release

Once epel repository RPM installed , it get added to machine .Now we can install Nginx packages from it like mentioned below.

# yum install nginx -y

Once process complete, We are done with Nginx installation . Now we need to start Nginx server.

[root@sample ~]# systemctl start nginx
[root@sample ~]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

In case you are running firewall, run the following commands to allow HTTP and HTTPS traffic

# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload

Now i hope you can able to open Nginx home page on browser with IP address like below mentioned.

Document Root

As it mentioned in First Nginx default Index page, Nginx has Document Root of /usr/share/nginx/html.Here we place our website content to display it on Web through Client’s Web browser.

Main configuration File

Nginx main configuration file would be /etc/nginx/nginx.conf which contain configuration parameters of Nginx which control Nginx working. Any change or editing would directly effect Nginx functioning.