How to Install Nginx on CentOS 8

Take Your Linux Skills to the Next Level All courses, certifications, ad-free articles & community — from $8/mo
Join Root →
Ad-free access to all premium articles
Access to all courses: Learn Linux, AI for Linux, Bash Scripting, Ubuntu Handbook, Golang and more.
Access to Linux certifications (RHCSA, RHCE, LFCS and LFCA)
Access new courses on release
Get access to weekly newsletter
Priority help in comments
Private Telegram community
Connect with the Linux community
From $8/mo · or $59/yr billed annually · Cancel anytime

Nginx (Engine X) is a most popular, powerful and high-performance open-source HTTP web server and reverse proxy server with a scalable event-driven (asynchronous) architecture. It can also be used as a load balancer, mail proxy, and HTTP cache due to its speed, stability, feature-rich set, easy configuration, and low resource utilization.

In this article, we will explain how to install the Nginx HTTP web server on a CentOS 8 Linux server.

Installing Nginx HTTP Web Server in CentOS 8

1. To install the latest version of Nginx web server, you need to update the system software packages using the following yum command.

# yum update

2. Once software updates installed, you can install the latest stable Nginx server from the default package repositories using the following commands.

# yum info nginx
# yum install nginx
Install Nginx Server on CentOS 8
Install Nginx Server on CentOS 8

3. Once Nginx installed, you can start, enable and verify the status by running following systemctl commands.

# systemctl start nginx
# systemctl enable nginx
# systemctl status nginx
Start and Enable Nginx Server
Start and Enable Nginx Server

4. Open and enable port 80 and 443 to allow web traffic on Nginx on the system firewall using following firewall-cmd commands.

# firewall-cmd --zone=public --permanent --add-service=http
# firewall-cmd --zone=public --permanent --add-service=https
# firewall-cmd --reload
Open Nginx Ports on CentOS 8 Firewall
Open Nginx Ports on CentOS 8 Firewall

5. Verify that the port 80 and 443 enabled on the firewall using netstat or ss command.

# netstat -tulpn
OR
# ss -tulpn
Verify Nginx Ports
Verify Nginx Ports

6. Now you can verify that the Nginx web server is up and running by visiting your server’s public IP address in your web browser. If you don’t know the IP address of your server, you can run the IP command.

# ip addr
Find CentOS Server IP Address
Find CentOS Server IP Address

In the output above, my server IP address is 192.168.0.103, so open your web browser and type the IP address.

http://192.168.0.103
Verify Nginx Web Page
Verify Nginx Web Page

That’s It! Once you have Nginx installed on your CentOS 8 server, you can go on to set up a LEMP Stack to deploy websites.

Root Plan
Premium Linux Education for Serious Learners

Take Your Linux Skills to the Next Level

Root members get full access to every course, certification prep track, and a growing library of hands-on Linux content — with new courses added every month.

What You Get
Ad-free access to all premium articles
Access to all courses: Learn Linux, AI for Linux, Bash Scripting, Ubuntu Handbook, Golang and more.
Access to Linux certifications (RHCSA, RHCE, LFCS and LFCA)
Access new courses on release
Get access to weekly newsletter
Priority help in comments
Private Telegram community
Connect with the Linux community
Ravi Saive
I'm Ravi Saive, an award-winning entrepreneur and founder of several successful 5-figure online businesses, including TecMint.com, GeeksMint.com, UbuntuMint.com, and the premium learning hub Pro.Tecmint.com.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.

Root Plan Premium Linux Education for Serious Learners

Before You Go - Upgrade Your Linux Skills

Root members get everything in one place, with new courses added every month.

What You Get
Ad-free access to all premium articles
Access to all courses: Learn Linux, AI for Linux, Bash Scripting, Ubuntu Handbook, Golang and more.
Linux certifications: RHCSA, RHCE, LFCS and LFCA
Access new courses on release
Weekly newsletter, priority support & Telegram community
Join Root Today and Start Learning Linux the Right Way
Structured courses, certification prep, and a community of Linux professionals - all in one membership.
Join Root Plan →
$8/mo · or $59/yr billed annually