How to install latest Nginx in CentOS 7

Share this post to your friends !
  • 1

SystemMen - How to install latest Nginx in CentOS 7? This article will guide you step by step to do that.

Test environment

I will use a Linux machine with the following configuration to test:

  • OS: CentOS 7.6.1810 (Core).
  • HDD: more than 5GB free.
  • RAM: more than 1GB free.
  • User: root.

Steps to install the latest Nginx in CentOS 7

Install Nginx

how-to-install-latest-nginx-in-centos-7 How to install latest Nginx in CentOS 7
How to install latest Nginx in CentOS 7.

First, run the following command to create a new file for the Nginx repository.

[root@centos7 ~]# nano /etc/yum.repos.d/nginx.repo

If you encounter an error like below.

bash: nano: command not found

Run this command to resolve it.

[root@centos7 ~]# yum install nano wget -y

After running the nano command to create the nginx.repo file, copy the content below to that file and save it.

name=nginx repo

Next, update the software packages in the server.

[root@centos7 ~]# yum update -y

And finally run the latest Nginx installation command for CentOS 7 machine.

[root@centos7 ~]# yum install nginx -y

At the time of this article, the latest stable version of Nginx is version 1.14.2.

Enable Nginx and use

To enable Nginx service in CentOS 7, type the following command.

[root@centos7 ~]# systemctl enable nginx
Created symlink /etc/systemd/system/, pointing to /usr/lib/systemd/system/nginx.service.

Start Nginx service for the first time.

[root@centos7 ~]# systemctl start nginx

And you can check if service port 80 is working or not with the following command.

[root@centos7 ~]# netstat -lnptu | grep 80


The article covered step by step so that you can successfully install the this webserver in CentOS 7. Now, you can start declaring virtual hosts on the server and add your websites there.

If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.

Share this post to your friends !
  • 1
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.