Install NGINX on CentOS

In the case of any web server, the performance is something that you need to keep in mind. In fact, performance is the main factor that decides the success of running a server. The faster the server, the better performance you get out of your current hardware config.

There are a number of available server apps out there. The most popular ones include Apache and NGINX. Both of them are free and open-source. Of course, in terms of popularity, Apache is a quite popular choice even in the world. In fact, more than 65% of all the servers in the current cyber world is powered by Apache!

However, that doesn’t diminish the benefits of NGINX (engine-ex – that’s how it’s pronounced). There are tons of additional benefits that NGINX provide that Apache fails to serve.

The first and foremost reason is the performance. NGINX, being a lightweight alternative to Apache, offers better overall performance than Apache. NGINX is also well-suited with the Linux and other UNIX-like environment. However, NGINX falls short in terms of flexibility. You need to compile additional modules into the NGINX binary in most cases as not all the modules of NGINX support dynamic module loading.

As both of them are free, you can easily start your own server right now! In today’s tutorial, we’ll be checking out NGINX running on my test CentOS system.

Installing NGINX

NGINX is available on the EPEL repository. Let’s start the installation!

At first, make sure that your system has EPEL repository enabled –

sudo yum install epel-release

sudo yum update

Now, time to perform the installation!!!

sudo yum install nginx

Starting NGINX

The installation is complete, time to fire it up! It’s not going to start itself all by itself!

sudo systemctl start nginx

If your system is configured to use a firewall, enable HTTP and HTTPS traffic from/to the server –

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

Time to test the server working –


Don’t have the IP address of the server? Then you can find out by running the following command –

ip addr

In my case, I need the “enp0s3” connection. Now, find out the IP address by running the following command –

ip addr show enp0s3 | grep inet | awk ‘{ print $2; }’ | sed ‘s//.*$//’

You may also want to enable NGINX every time your system boots up –

sudo systemctl enable nginx

Additional configurations

The default configuration isn’t always the best one as it depends on the particular usage case. Fortunately, NGINX comes up with a handy set of configuration files.

  • NGINX global configuration file
  • Default server root
  • Server block configuration


ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

NGINX: Block Based on Geographical Location

Nginx is a high performance, lightweight, open source web server available to public for free of charge. It has tremendous...

Nginx Reverse Proxy

What is a reverse proxy? A proxy server is the one that talks to the Internet on your behalf. For example, if your college’s...

How to Block Hotlinking with Nginx

Nginx is a lightweight web server capable of handling humongous number of requests at a given time without making the server...
Bài Viết

Bài Viết Mới Cập Nhật

mua Proxy riêng ở đâu, và nó đem lại lợi ích gì cho người sử dụng

Hướng dẫn sử dụng Proxy Helper Fakeip khi thuê proxy


Mua Proxy Nuôi Zalo Giá Rẻ Tại