How to Install the Latest Stable Nginx on AlmaLinux / Rocky Linux

How to Install the Latest Stable Nginx on AlmaLinux / Rocky Linux

Bitnesia Linux Mar 24, 2026 527 ID

Nginx is one of the most popular and reliable web servers in the world. In addition to being a web server, Nginx also functions as a reverse proxy, load balancer, and HTTP cache with high performance and low resource consumption.

By default, the built-in repositories in AlmaLinux 9 or Rocky Linux 9 only provide Nginx version 1.20, which is stable but already considered outdated. To get the latest stable version (currently 1.28), we can install it directly from the official Nginx repository.

Why Use the Latest Stable Version

There are several strong reasons to use the latest stable release of Nginx:

  1. Better security: The latest version includes important security patches and bug fixes.
  2. Improved performance: Internal optimizations and support for modern protocols.
  3. New features: Such as dynamic module loading and more flexible configuration options.
  4. Long-term support: Nginx.org provides regular stable updates for production environments.

Therefore, installing Nginx from the official Nginx repository is the ideal approach for system administrators who want the newest features and long-term stability without building from source.

Steps to Install the Latest Stable Nginx

Below are the complete steps to install Nginx 1.28 (the latest stable version) on AlmaLinux or Rocky Linux 9.

Update the System

Make sure your system packages are up to date:

sudo dnf update -y

Add the Official Nginx Repository

Create a new repository file:

sudo vi /etc/yum.repos.d/nginx.repo

Add the following configuration inside the file:

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

Save and exit (:wq if using vi).

Install Nginx

Run the following commands to update and install Nginx:

sudo dnf update -y
sudo dnf install -y nginx

Enable and start the Nginx service:

sudo systemctl enable --now nginx

Check the service status:

systemctl status nginx

Verify the Installation

After installation is complete, check the installed Nginx version:

nginx -v

The output should show the latest stable version from the official repository:

nginx version: nginx/1.28.0

Next, open your web browser and access:

http://<alamat-ip-server>

If the installation was successful, you will see the default Nginx welcome page displaying “Welcome to nginx!”.

Conclusion

With the steps above, you have successfully installed the latest stable version of Nginx (1.28) on AlmaLinux / Rocky Linux 9 using the official Nginx repository. This version offers improved performance, modern features, and the latest security updates. As the next step, you can configure Nginx as a reverse proxy, load balancer, or enable additional features such as SSL/TLS with Let’s Encrypt.

Congratulations! Your Nginx server is now ready for production use with the latest stable release.

I love keeping these tutorials free for everyone. If you've saved time or learned something new today, consider making a small donation to keep this site ad-free.

Support Free Content

Related Posts