This guide will show you How To Install Nginx Web Server on Rocky Linux 9|AlmaLinux 9. NGINX is a powerful web server and reverses proxy servers. The first Red Hat version 8 family release in which the default repository includes NGINX packages by default. NGINX can be used as a web server because of its low footprinting. It can be used in a production environment by installing it on a reputable enterprise Linux.
Install Nginx Web Server on Rocky Linux 9|AlmaLinux 9
Let’s dive into the installation of the Nginx Web server on Rocky Linux 9|Alma Linux 9, follow the below steps.
#1. Update system packages
First, update system packages to avoid dependency issues:
sudo dnf update
sudo reboot
#2. Install Nginx Web Server
Run the command below to install the Nginx Web server on Rocky Linux 9|AlmaLinux 9:
sudo dnf install nginx -y
Dependency tree;
Dependencies resolved.
================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================
Installing:
nginx x86_64 1:1.20.1-13.el9 appstream 38 k
Installing dependencies:
nginx-core x86_64 1:1.20.1-13.el9 appstream 567 k
nginx-filesystem noarch 1:1.20.1-13.el9 appstream 11 k
rocky-logos-httpd noarch 90.13-1.el9 appstream 24 k
Transaction Summary
================================================================================================================================
Install 4 Packages
Total download size: 640 k
Installing : nginx-1:1.20.1-13.el9.x86_64 4/4
Running scriptlet: nginx-1:1.20.1-13.el9.x86_64 4/4
Verifying : rocky-logos-httpd-90.13-1.el9.noarch 1/4
Verifying : nginx-filesystem-1:1.20.1-13.el9.noarch 2/4
Verifying : nginx-1:1.20.1-13.el9.x86_64 3/4
Verifying : nginx-core-1:1.20.1-13.el9.x86_64 4/4
Installed:
nginx-1:1.20.1-13.el9.x86_64 nginx-core-1:1.20.1-13.el9.x86_64 nginx-filesystem-1:1.20.1-13.el9.noarch
rocky-logos-httpd-90.13-1.el9.noarch
Complete!
#3. Start and Enable Nginx on Rocky Linux 9|AlmaLinux 9
Start Nginx services as soon as the installation is finished using the following command;
sudo systemctl start nginx
Then enable Nginx;
sudo systemctl enable nginx
Confirm Nginx status;
systemctl status nginx
Output:
● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2023-04-04 20:06:17 EAT; 1min 7s ago Main PID: 3303 (nginx) Tasks: 3 (limit: 23003) Memory: 2.8M CPU: 30ms CGroup: /system.slice/nginx.service ├─3303 "nginx: master process /usr/sbin/nginx" ├─3304 "nginx: worker process" └─3305 "nginx: worker process" Apr 04 20:06:17 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server... Apr 04 20:06:17 localhost.localdomain nginx[3301]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
#4. Allow Access through the Firewall
Add the service HTTP and HTTPS ports to the firewalled firewall so that the website is publicly accessible.
sudo firewall-cmd --permanent --add-service={http,https}
When finished, refresh the firewall to activate the new rules and flush out the old ones.
sudo firewall-cmd --reload
By typing “localhost” in your browser, you may verify that Nginx is functioning properly.
![](https://i0.wp.com/tutornix.com/wp-content/uploads/2022/12/Screenshot-from-2022-12-02-11-15-38.png?resize=700%2C462&ssl=1)
If you’ve arrived at this page, your server is up and running and ready to be managed.
You can also use the command line to verify that your website is operational:
Syntax; curl -I http://<your-ip-address>
curl -I http://192.168.56.102
Output:
HTTP/1.1 200 OK Server: nginx/1.20.1 Date: Tue, 04 Apr 2023 17:12:21 GMT Content-Type: text/html Content-Length: 7620 Last-Modified: Thu, 02 Feb 2023 21:29:03 GMT Connection: keep-alive ETag: "63dc2b1f-1dc4" Accept-Ranges: bytes
Conclusion
Congratulations! Nginx has been successfully installed. Thank you for following this guide to install the Nginx web server on your Rocky Linux 9|AlmaLinux 9 system.
Check Nginx documentation.
Other tutorials;