Nginx is a high-performance open source web server and reverse proxy server, popular for its lightweight and high performance. In this tutorial, we will learn to install and configure Nginx on CentOS 8 operating system.
Step 1: Update the system
Before installing any software, let's update the system's package list and installed packages.
sudo yum update
Step 2: Install Nginx
Now, we can yum
install Nginx using the package manager.
sudo yum install nginx
Step 3: Start Nginx
After the installation is complete, start the Nginx service.
sudo systemctl start nginx
Step 4: Set up autostart
Make sure Nginx starts automatically on system boot.
sudo systemctl enable nginx
Step 5: Configure Firewall
If the system has a firewall (firewalld) enabled, allow HTTP (80) and HTTPS (443) traffic to pass. If you have not installed a firewall, you can install and enable it with the following command:
sudo yum install firewalld
sudo systemctl start firewalld
sudo systemctl enable firewalld
Then, allow HTTP and HTTPS traffic:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Step 6: Verify Nginx Installation
Browser input IP address access test
Nginx is now installed and running on your CentOS 8 system yum
. You can verify that Nginx is running properly by entering your server's IP address or domain name into a web browser. If everything is set up correctly, you should be able to see Nginx's default welcome page.