Install Nginx on RHEL 9
This guide walks through installing and starting Nginx on RHEL 9.
Step 1 – Update the system and enable EPEL
dnf update -y
subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
Step 2 – Install Nginx
dnf install -y nginx
Step 3 – Start and enable Nginx
systemctl enable --now nginx
Step 4 – Allow HTTP and HTTPS traffic
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
Step 5 – Verify the installation
nginx -v
curl -I http://localhost
Nginx is now running. Its main configuration file is /etc/nginx/nginx.conf
and virtual-host snippets go in /etc/nginx/conf.d/.