How To Install Nginx on CentOS 7

In this tutorial, we will see how to install Nginx on CentOS 7

About Nginx

Nginx is a high performance web server software. It is a much more flexible and lightweight program than Apache HTTP Server.


  •  User to have root privileges

Step One — Add Epel Repository

To add Epel repo, open the terminal and run the below command

sudo yum install epel-release

Step Two — Install Nginx

Now repository is installed on the server, to install nginx use below command

sudo yum install  nginx -y

Step Three — Start Nginx

To Start the nginx service, type

sudo systemctl start nginx

To ensure the nginx service started successfully by using below command,

sudo systemctl status nginx

Step four — Firewall rule update

If firewall is running on the server, type below command

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

Step Five — Verify Nginx status

To verify the nginx is successfully and its ready to serve web content, type the server IP in browser, you will get Nginx default Welcome message like below

Once you see this message, We installed Nginx successfully on the server.

Step Six — Enable Nginx service on system boot

To start the nginx service on every system boot, type the command

sudo systemctl enable nginx

Congratulations! Nginx is now installed and running!




You may also like...

Leave a Reply

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