How to Install Nginx on AlmaLinux 10
Introduction
Nginx is a high-performance web server, reverse proxy, load balancer, and HTTP cache. It is widely used to host websites, serve static content, and proxy requests to backend applications.
This guide explains how to install Nginx on AlmaLinux 10, start the service, configure the firewall, and verify that the web server is working correctly.
Prerequisites
Before installing Nginx, ensure that:
* You are running AlmaLinux 10.
* You have sudo or root privileges.
* Your system is connected to the Internet.
Update System Packages
Update your system before installing Nginx:
Install Nginx
Install Nginx using DNF:
After installation, verify the installed package:
Enable and Start Nginx
Enable Nginx to start automatically after boot:
Start the service:
Check the current status:
You should see that the service is **active (running)**.
Verify the Installation
Display the installed version:
Or display detailed build information:
Open your browser and visit:
If everything is configured correctly, the default Nginx welcome page will be displayed.
Configure the Firewall
If firewalld is enabled, allow HTTP traffic:
For HTTPS support:
Verify the firewall rules:
Common Nginx Commands
Start Nginx:
Stop Nginx:
Restart Nginx:
Reload the configuration:
Disable automatic startup:
Nginx Configuration Files
Main configuration file:
Virtual host configuration directory:
Website document root:
Log files:
Test the Configuration
Before reloading Nginx after editing configuration files, test the configuration:
Example output:
Uninstall Nginx
Remove Nginx:
Verify removal:
If the command is no longer available, Nginx has been removed successfully.
Conclusion
Installing Nginx on AlmaLinux 10 is straightforward using the DNF package manager. After installation, remember to enable the service, allow HTTP and HTTPS through the firewall, verify the configuration with `nginx -t`, and monitor the log files when troubleshooting.
Related AlmaLinux 10 Tutorials
How to Install PostgreSQL on AlmaLinux 10
Explore More
› How to Enable Gzip Compression in Nginx
› How to Configure Nginx FastCGI Cache for Better PHP Performance