Web Servers

How To Install NGINX on CentOS

In this article, we will discuss how to install NGINX on CentOS.

Ngnix (Pronounce as Engine X) is a free, open source web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. Unlike traditional servers, NGINX doesn’t rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but more importantly, predictable amounts of memory under load.

Prerequisites

You need to install CentOS 7 on cloud server or dedicated server.
SSH to the server using root user.

For the demonstration, we have used CentOS 7 to install NGINX.

1. Keep the server up-to-date:

# yum update -y

2. Add EPEL(Extra Packages for Enterprise Linux) repository:

# yum install epel-release

3. Now, install NGINX using following command:

# yum install nginx

Your web server is installed.

4. Once it is installed, you can start NGINX using following command:

# systemctl start nginx

5. Enable the NGINX for persistent:

# systemctl enable nginx

That’s it, now you can access it using you server IP:

Open in a web browser:
http://server_domain_name_or_IP/

The default server root directory is /usr/share/nginx/html. Files that are placed in there will be served on your web server. This location is specified in the default server block configuration file that ships with Nginx, which is located at /etc/nginx/conf.d/default.conf.

In this article, we have learnt how our support engineers install NGINX on CentOS.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles