In this tutorial, we will show you how to install Nginx on AlmaLinux 8. For those of you who didn’t know, Nginx (Pronounce as Engine X) is a powerful web server software that can be used on your server. It is also known for its high performance and low memory usage which will allow fewer resources to be used but getting the job done efficiently. A popular setup is to use it as a proxy for Apache, which can then serve application requests.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Nginx on an AlmaLinux 8.
Install Nginx on AlmaLinux 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update sudo dnf install epel-release
Step 2. Installing Nginx on AlmaLinux 8.
Now we run the following command to install the Nginx webserver:
sudo dnf install nginx
Once it is installed, you can start and enable the Nginx service using the following command:
sudo systemctl enable nginx sudo systemctl start nginx
After that, we add HTTP and HTTPS ports in the firewall using the following command:
sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --reload
Next, verify that the webserver is running and accessible by accessing your server’s IP address:
Step 3. Nginx Configuration File’s Structure.
You don’t need to configure Nginx after successful installation. However, you should know the location of the configuration files and the Nginx root directory in case you need to modify the configuration.
- Nginx configuration directory:
- Nginx root directory:
- Master/Global configuration file:
Congratulations! You have successfully installed Nginx. Thanks for using this tutorial for installing the Nginx web server on your AlmaLinux 8 system. For additional help or useful information, we recommend you check the official Nginx website.