Yesterday we showed you how to install the latest version of Nginx HTTP server on Ubuntu 14.10. This brief post is going to show you how to install Nginx latest on CentOS 7.

If you’re reading this, then you probably know a thing or two about Nginx so I am not going to be describing Nginx in details. Most information on Nginx web server can be found online simply by going to Google and searching on it.

What this tutorial shows you is how to easily install the latest version of the Nginx HTTP web server on CentOS 7 and how to allow HTTP traffic since HTTP traffic is denied or blocked by default.

For those who do don’t know Nginx is, it’s a fast, lightweight and powerful HTTP server. It can be used as a standalone HTTP server or proxy to another web server.

We have been running Nginx on this blog for a while now and it’s perfect! If you know how to optimize and configure Nginx properly, it could really help improve your website loading time.

Running Nginx with Memcached is also a plus. Our next post on Nginx will feature memcached installation and configuration with Nginx. Today will only focus on installing Nginx.


  • Installing Nginx Latest on CentOS 7

Nginx isn’t part of CentOS default repositories. You can’t just run yum install nginx and it gets download and installed. In order to get Nginx, you must install and add additional external repositories.

Nginx has its own repositories. Two repositories that are available from Nginx are the stable and mainline repositories. The mainline repository contains features that are new and recently added to Nginx.

The latest version of Nginx is always going to be found in the mainline repository.

The stable repository contains features of Nginx that have been test and proven. All new features are introduced in the mainline repository first, and after thorough testing and validation that they function, they are then move down to the stable repository.

So, if you need to install the latest of Nginx, add its mainline repository. To do that, run the commands below to create a new repository file for Nginx.

sudo vi /etc/yum.repos.d/nginx.repo

Then copy and paste the lines below into the file and save it.

name=nginx repo

After that, run the commands below to install Nginx.

sudo yum install nginx


  • Allowing HTTP Traffic

By default HTTP traffic is not allowed to CentOS 7. To enable it, open the firewall to allow it through. To do that, run the commands below.

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

That’s it! You can now go and access the server by browsing to the hostname or IP address.


If you want Nginx stable version, then here’s the repository for it.

name=nginx repo