How to Install and Configure Nginx on CentOS/Rhel 7.x

How To Install and Configure Nginx Server on CentOS/Rhel 7.x


Add the CentOS/Rhel 7 EPEL repository for installation of Nginx Server, Use the following command :

#yum install epel-release

Now install Nginx Server using the following command :

#yum install nginx

Now start the Nginx Service using the following command :

#systemctl start nginx

Now Enable the Nginx Service to start at boot :

#systemctl enable nginx

Add the following rule in the firewall using the following command :

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

Now Configure the Basic Settings using following command :

#vim /etc/nginx/nginx.conf

Now change the hostname in the Nginx configuration file :


Now restart the Nginx Service using following command :

#systemctl restart nginx

Now access to the default page of Nginx by the following address,

Leave a Reply

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