Linux Capable published a guide about installing the latest Nginx mainline on Rocky Linux 8.
How to Install Latest Nginx Mainline on Rocky Linux 8
First, you need to remove any previous Nginx installations that are active before installing Nginx Mainline.
How to Install Latest Nginx Mainline on Rocky Linux 8 - LinuxCapable