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:
- Better security: The latest version includes important security patches and bug fixes.
- Improved performance: Internal optimizations and support for modern protocols.
- New features: Such as dynamic module loading and more flexible configuration options.
- 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 -yAdd the Official Nginx Repository
Create a new repository file:
sudo vi /etc/yum.repos.d/nginx.repoAdd 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=trueSave 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 nginxEnable and start the Nginx service:
sudo systemctl enable --now nginxCheck the service status:
systemctl status nginxVerify the Installation
After installation is complete, check the installed Nginx version:
nginx -vThe output should show the latest stable version from the official repository:
nginx version: nginx/1.28.0Next, 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.




