Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Install Nginx on Rocky Linux and AlmaLinux

Install NGINX on Rocky Linux or AlmaLinux with dnf, then enable systemd, open firewalld, validate configuration, and add server blocks. This guide explains when to use the distribution package versus NGINX’s stable or mainline repository.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On Rocky Linux or AlmaLinux, install the open-source NGINX server with sudo dnf install nginx -y, start it with systemd, open HTTP/HTTPS in firewalld, and verify both local and remote access. The distribution package is the simplest choice; the official NGINX repository is preferable when you need the vendor’s stable or mainline update stream.

Choose your package source first

Rocky Linux and AlmaLinux are RHEL-compatible distributions, so NGINX is installed as the nginx RPM through dnf (the successor to yum). You have two practical sources:

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Choice Package freshness Setup effort Update and support considerations
Distribution AppStream or enabled distribution repositories Follows the versions and lifecycle selected by your Rocky Linux or AlmaLinux release. Lowest; normally just one dnf install command. Best integration with the operating system’s module/AppStream stream and normal distribution support expectations.
Official NGINX repository Direct access to the vendor’s stable stream, with mainline available as an intentional opt-in. Requires creating a repository file and checking its signing key. You choose the NGINX update stream and receive packages from the vendor’s repository; confirm that the repository supports your OS major version and CPU architecture.

Neither stream is universally “better.” Use the distribution package when operational simplicity and distribution integration matter most. Use the official repository when you need the vendor’s release cadence or a deliberate stable-versus-mainline choice. Do not mix repositories casually: changing sources can alter dependency and update behavior.

Check the host before installing

  • Confirm that the machine is running a supported Rocky Linux or AlmaLinux major release and that you have an account allowed to use sudo.
  • Make sure the server has working DNS or another way to reach the package mirrors or repository you selected.
  • Record whether firewalld is active. AlmaLinux’s examples assume firewalld is enabled by default; a running service can allow local requests while blocking outside clients.
  • Keep SELinux enforcing unless a documented policy change is required for your particular application. Disabling it is not an installation fix.

Run an update before installing so repository metadata and installed packages are current for the host’s release:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
sudo dnf update -y

The command may install ordinary operating-system updates. Review any reboot requirement reported by your normal maintenance process before exposing a production service.

Install NGINX from the distribution repositories

1. Install the RPM

sudo dnf install nginx -y

dnf resolves the NGINX RPM and its dependencies, then places the service unit and the standard configuration tree on the system. A successful transaction returns you to the shell without an error and makes the nginx systemd unit available.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. If dnf says no package is available

Repository configuration can differ between releases and minimal installations. If the command reports that no NGINX package is available, NGINX’s installation guidance uses Extra Packages for Enterprise Linux (EPEL) metadata as a recovery path:

sudo dnf install epel-release -y
sudo dnf clean all
sudo dnf makecache
sudo dnf install nginx -y

If the package is still unavailable, check that the enabled repositories match the installed OS major version and architecture. Do not substitute a repository stanza intended for another release. At that point, use the official NGINX repository procedure below or correct the distribution repository configuration.

Install from the official NGINX repository

The vendor repository is useful when you want direct control over NGINX’s stable or mainline stream. NGINX recommends configuring the package manager to use its official repository for the latest official release and better control over updates.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

1. Obtain the matching repository definition

Open NGINX’s official Linux package instructions and select the repository entry for your installed Rocky Linux or AlmaLinux major version and architecture. Create the repository file named /etc/yum.repos.d/nginx.repo and paste the current stable-repository stanza supplied for that platform:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo vi /etc/yum.repos.d/nginx.repo

The exact base URL is release-dependent, so copy it from the current vendor instructions rather than reusing a line from an older operating system. Keep the repository’s GPG verification enabled with gpgcheck=1.

2. Decide between stable and mainline

  • Stable: the default vendor stream and the conservative choice for most production installations.
  • Mainline: an opt-in stream for readers who deliberately need newer NGINX changes and accept a faster-moving package line.

Choose one stream in the repository definition and document that choice. Do not imply that mainline is automatically faster or that stable is always more secure; the appropriate stream depends on your compatibility and change-management requirements.

3. Verify the signing key

When dnf first imports the repository signing key, compare the displayed fingerprint with the fingerprint published in NGINX’s package documentation. Accept the key only when the values match. GPG checking protects you from installing an RPM whose signature cannot be validated; turning it off to bypass a prompt defeats that protection.

4. Install the package

sudo dnf makecache
sudo dnf install nginx -y

If you previously installed the distribution package and are changing to the vendor repository, review the transaction carefully. Verify the resulting package source and stream after the operation, and schedule repository changes as a controlled maintenance action rather than combining them with unrelated upgrades.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Enable, start, and validate the service

Installing an RPM does not replace checking that the daemon is running and enabled for future boots. Use systemd:

sudo systemctl enable --now nginx
sudo systemctl status nginx

enable --now both starts NGINX immediately and enables its service at boot. The status output should show an active running service. If it is not active, inspect the unit log before changing configuration:

sudo journalctl -u nginx

Check configuration syntax before every reload

sudo nginx -t

A successful test reports that the syntax is okay and the configuration test is successful. A failure includes the file and line that needs attention. Correct that error and run the test again; never reload a configuration that has not passed the syntax check.

Open HTTP and HTTPS in firewalld

A browser on the server can reach 127.0.0.1 even when the network firewall rejects outside connections. If firewalld is running, add the standard web-service definitions permanently and reload the firewall:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo firewall-cmd --permanent --add-service={http,https}
sudo firewall-cmd --reload

The first command writes the permanent rules for ports associated with HTTP and HTTPS; the second applies them to the active configuration. If you intend to serve only HTTP during an initial test, you can add just http, then add HTTPS when TLS is configured. Confirm the active rules with:

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
sudo firewall-cmd --list-services

Opening a firewall service does not create a virtual host or certificate. NGINX still needs a listening server block and, for HTTPS, a valid TLS configuration.

Test NGINX locally and from another machine

Local request

curl -I http://127.0.0.1/

The response headers confirm that a process answered on the local HTTP socket. A status such as 200 or an intentional redirect proves that NGINX handled the request; an error points you back to service status, listeners, or configuration.

Remote request

From a different computer, request the server’s address:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -I http://SERVER_ADDRESS/

Replace SERVER_ADDRESS with the host’s reachable IP address or DNS name. A local success combined with a remote timeout usually indicates firewalld, a cloud or upstream network security rule, an incorrect address, or a service bound only to a local interface. A remote HTTP response means the network path and an NGINX listener are working; hostname routing and application-specific configuration can then be debugged separately.

Add a site with a server block

Keep additional virtual-host configuration in /etc/nginx/conf.d/. Rocky Linux’s guide documents the standard /etc/nginx/conf.d/*.conf include path, so a file ending in .conf is loaded by the main configuration:

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
sudo vi /etc/nginx/conf.d/example.conf

A minimal HTTP server block can look like this:

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;

    root /var/www/example;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}

Create the document root and an initial file with permissions appropriate to your deployment, then test the configuration:

sudo nginx -t
sudo systemctl reload nginx

Reloading asks the running service to adopt the validated configuration without stopping the daemon. If the test fails, use the reported file and line number, correct the block, and test again. Keep separate site files so a mistake in one virtual host is easy to identify.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

SELinux and file-access issues

SELinux should remain enforcing during installation. A newly installed NGINX configuration can be syntactically valid yet unable to read a custom document root because the files have an unsuitable SELinux context or Unix permissions. Treat that as a policy and labeling problem, not a reason to disable SELinux.

  • First confirm ordinary ownership and read/execute permissions on every directory in the path.
  • Check the system audit log when NGINX reports permission-denied errors despite apparently correct Unix permissions.
  • Use the distribution’s documented SELinux labeling and policy tools for the service and content location, then retest.

Only make a policy change that you can explain and maintain. An installation guide cannot safely prescribe one context for every application, proxy target, or storage layout.

Troubleshoot common installation failures

Symptom Likely cause Checks and corrective action
dnf install nginx reports no match The required repository is disabled or metadata is stale. Install epel-release, run dnf clean all and dnf makecache, then retry. If it remains unavailable, configure the matching official NGINX repository.
Service fails immediately after starting Syntax error, port conflict, missing file, or permission problem. Run sudo nginx -t, then sudo systemctl status nginx and sudo journalctl -u nginx. Fix the named cause before another start attempt.
Local curl works; remote request times out Firewalld or an upstream network filter is blocking web traffic. Check sudo firewall-cmd --list-services, add http,https permanently if needed, reload firewalld, and check any external network security controls.
Remote request reaches the wrong site The request’s host name does not match the intended server_name, or another server block is selected. Inspect files in /etc/nginx/conf.d/, verify the requested DNS name and server_name, run nginx -t, and reload.
NGINX returns permission denied for content Unix permissions or SELinux labeling prevents access. Check directory traversal and file-read permissions, review audit messages, and apply the documented SELinux context for the chosen content path. Do not disable SELinux as a shortcut.
Repository key prompt is unexpected The repository key has not yet been imported or the repository definition is wrong. Stop and compare the key fingerprint with NGINX’s published fingerprint. Verify the OS major-version and architecture entry before accepting anything.

Maintain the installation safely

Keep a record of whether the host uses the distribution repository or the official NGINX repository and, for the latter, whether it follows stable or mainline. That record prevents an administrator from unknowingly switching streams during a routine update.

  • Use the normal dnf update process for the selected source rather than downloading unverified RPM files.
  • Read package transaction changes, especially when a repository definition has recently been added or modified.
  • After an update, run sudo nginx -t and check sudo systemctl status nginx.
  • When changing a server block, test syntax before sudo systemctl reload nginx.
  • Keep firewalld rules limited to services the server actually provides; opening HTTPS before configuring TLS does not make the endpoint secure.

AppStream or the official repository: a practical decision

Choose AppStream or the distribution package when

  • You want the fewest moving parts on a standard Rocky Linux or AlmaLinux server.
  • Your organization prefers distribution lifecycle testing and support conventions.
  • The NGINX features available in that OS release meet your application’s requirements.

Choose the official NGINX repository when

  • You need the vendor’s stable stream rather than the version selected by the distribution.
  • You intentionally want the mainline stream and have a process for testing faster-moving updates.
  • You are prepared to verify GPG fingerprints, maintain the repository file, and confirm compatibility after OS upgrades.

Whichever path you select, the operational sequence remains the same: install the nginx RPM, enable and start systemd, validate with nginx -t, permit traffic in firewalld when applicable, test locally and remotely, then place site-specific files under /etc/nginx/conf.d/.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What this installation does not include

This procedure installs open-source NGINX. NGINX Plus is a separate commercial product with different licensing and repository steps; do not treat its instructions as interchangeable with the RPM installation above. Likewise, installing NGINX does not automatically configure DNS, application backends, TLS certificates, proxy routes, rate limits, or monitoring. Add those pieces only after the base service is running and its configuration passes validation.

Final verification checklist

  • sudo dnf install nginx -y completed from the repository source you intended.
  • sudo systemctl enable --now nginx reports an active service.
  • sudo nginx -t reports successful syntax and configuration tests.
  • curl -I http://127.0.0.1/ receives an HTTP response.
  • When firewalld is active, its service list includes the web protocols you actually use.
  • A request from another machine reaches the server’s address.
  • Each file in /etc/nginx/conf.d/ has a valid server block, and every change is followed by a syntax test and reload.
  • SELinux remains enforcing, with documented labels or policy adjustments applied only where required.

For most Rocky Linux and AlmaLinux installations, the distribution package is the fastest reliable route. Move to the official NGINX repository only when its stable or mainline stream provides a requirement that justifies the additional repository and signing-key maintenance.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.