Similarly, you can install nginx using the following command in RockyLinux terminal : sudo yum -y install nginx . After installation is complete it will be available for use via http.
Total download size: 996 k Installed size: 3.3 M Downloading Packages: nginx-1.26.3-2.el9.ngx.x86_64.rpm 428 kB/s | 996 kB 00:02 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Installed: nginx-2:1.26.3-2.el9.ngx.x86_64 ... Complete! [root@localhost ~]#
Preparing the test webpage
NGINX has been installed, so let’s test whether it can serve a webpage. By default, NGINX requires us to place web pages in the /usr/share/nginx/html directory, with the homepage named either index.html or index.htm.
I have prepared a homepage with the content: “Hello nginx, I’m Haoyang Sun!”.
[root@localhost ~]# systemctl status nginx ● nginx.service - nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: disabled) Active: active (running) since Sun 2025-03-09 23:47:45 EDT; 3h 2min ago Docs: http://nginx.org/en/docs/ Process: 21534 ExecStart=/usr/sbin/nginx -c ${conffile} (code=exited, status=0/SUCCESS) Main PID: 21535 (nginx) Tasks: 5 (limit: 47268) Memory: 5.1M CPU: 16ms CGroup: /system.slice/nginx.service ├─21535 "nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf" ├─21536 "nginx: worker process" ├─21537 "nginx: worker process" ├─21538 "nginx: worker process" └─21539 "nginx: worker process"
Mar 09 23:47:45 localhost.localdomain systemd[1]: Starting nginx - high performance web serv> Mar 09 23:47:45 localhost.localdomain systemd[1]: Started nginx - high performance web serve>
Opening the firewall
To allow access to the NGINX service, configure the firewall accordingly.
This ensures that incoming traffic can reach the web server.
Copyright Notice: This article is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the original author and source when sharing.