Skip to main content

Install Nginx on CentOS 8

  • Post Author
    By wsiang
  • Post Date
    Mon Mar 15 2021

Nginx is known as a web server with high-performance and low resource consumption. It’s popularity is almost similar to Apache as the most popular web server. This post will describes how to install nginx on CentOS 8.

Prerequisites

CentOS 8 with root user or sudo user access.

Install Nginx

  1. Run this command to install the nginx
sudo dnf install nginx
  1. Run this command to start nginx service
sudo systemctl start nginx
  1. Run this command to check nginx service’s status
sudo systemctl status nginx

You should see output like this

  1. Run this command to start nginx service on boot
sudo systemctl enable nginx
  1. Nginx has been running but you need to configure the firewall to allow http connection to the CentOS
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

Now you can open your browser and enter the url with the CentOS ip address, then you should see the default page of nginx in your browser.

Hi, my name is Wie Siang This blog was created to share my experience as a software engineer. "Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time." -Thomas Alva Edison-
Hi, my name is Wie Siang This blog was created to share my experience as a software engineer. "Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time." -Thomas Alva Edison-