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 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...

How to Install Free SSL Certificate for Nginx on Debian 10

TLS and SSL protocols cipher the connection between a site (or other service, but in this tutorial Nginx is the focus)...
Bài Viết

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

Huớng dẫn dùng proxy cho ios, iphone 2023

Cách gắn set proxy cho điện thoại android, oppo, giả lập android, Ldplayer Bằng Proxydroid

Mua Proxy Socks5 VN Chơi Game Gia Lập Tăng Cường Trải Nghiệm Chơi Game

Mua Proxy Mỹ, Us Nuôi Tài Khoản Etsy, eBay Tìm Hiểu Về Mua Proxy Mỹ tại

Mua Proxy Game – Giải pháp tuyệt vời cho việc chơi game trên mạng mà không bị giới hạn về vị trí địa lý