In this article, we will have explained the necessary steps to install Nginx on Rocky Linux 9. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
Nginx is a powerful and open-source web server that optimizes content and application delivery, focusing on security and facilitating the scalability of applications. In addition to its HTTP server capabilities, Nginx can function as a proxy server for e-mail (IMAP, POP3, and SMTP) and a reverse proxy and load balancer for HTTP, TCP, and UDP servers. Nginx has grown in popularity since its release due to its light-weight resource utilization and its ability to scale easily on minimal hardware.
- Operating System with Rocky Linux 9
- Server IPv4 Address with Superuser Privileges (Root Access)
- Gnome Terminal for Linux Desktop
- PuTTy SSH client for Windows or macOS
- Powershell for Windows 10/11
- Familiar with DNF Commands
Install Nginx on Rocky Linux 9
Step 1. First, before you start installing any package on your Rocky Linux server, we always recommend making sure that all system packages are updated.
sudo dnf update sudo dnf upgrade
Step 2. Install Nginx Web Server on the Rocky Linux.
Installing Nginx on your Rocky Linux system is straightforward, Use the following command to install the Nginx stable version:
sudo dnf install nginx
The service will not be started by default. To start Nginx, use this command:
sudo systemctl enable nginx --now sudo systemctl status nginx
Confirm the installed Nginx:
rpm -qi nginx
Step 3. Configure FirewallD Rules.
To make your pages available to the public, you will have to edit your firewall rules to allow HTTP requests on your web server by using the following commands:
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload
Step 4. Verify Nginx Web Server.
Verify that the web server is running and accessible by accessing your server’s IP address:
That’s all you need to do to install Nginx on Rocky Linux 9. I hope you find this quick tip helpful. For further reading on the Nginx web server, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.