How to Install Nginx Web Server on CentOS 7

NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. It is a rival to the Apache web server and used extensively throughout the internet.

This tutorial will show you how to install Nginx on CentOS 7.

So to begin we’ll need to ensure that we have epel repository installed. We can do so by running the command:

  • sudo yum install epel-release

Next we can install Nginx using yum. The command to do so is:

  • sudo yum install nginx.

Next we’ll start the Nginx web server and insure it starts when the server is powered on. The two commands to do this are:

  • sudo service nginx start
  • sudo chkconfig nginx on

Now we need to navigate to our localhost. To do so open a browser window and type in localhost. You should see a screen similar to the one below:

Now that we know that Nginx is working as we expect, lets remove the default Index.html and enter our own. First delete the default index.html by running:

  • sudo rm /usr/share/nginx/html/index.html

Now create your own file using vi:

  • sudo vi /usr/share/nginx/html/index.html

Enter some test text into your file and save it. Now refresh your browser window. You should see the changes replicated. When we refreshed ours it looked like the image below:

 

A full video tutorial on how to install Nginx can be found here:

This entry was posted in CentOS, learning, linux, nginx, web server and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

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