DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk9 min

How to Install the Latest Version of Nginx on Ubuntu

A step-by-step Ubuntu guide to installing NGINX from the official repository, choosing Mainline or Stable, verifying signatures and versions, and troubleshooting failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For the newest upstream NGINX release on Ubuntu, configure the official nginx.org APT repository and choose its Mainline stream before installing. Mainline is NGINX’s current release stream; Stable changes more conservatively. Ubuntu’s built-in apt install nginx remains the easiest option, but its package can lag behind upstream.

This guide shows how to check your Ubuntu release and architecture, authenticate the repository, pin it so APT prefers nginx.org packages, install either stream, verify the exact version, and locate the files and logs you will need to operate the server safely.

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.

Choose the installation source first

Your choice determines how quickly you receive upstream fixes and features, and how closely the package follows Ubuntu’s own integration.

Source Best for What to expect
Ubuntu repository Simple, distribution-integrated maintenance One command installs dependencies and starts the web server, but the available NGINX build may not be the newest upstream release.
nginx.org Stable Production systems that favor a slower change rate Official NGINX packages from the conservative release stream.
nginx.org Mainline Readers asking for the latest upstream version The current upstream release stream, with features and fixes arriving sooner.

For a new deployment where “latest” means the newest official package, use the Mainline procedure below. If compatibility testing or a tightly controlled change window matters more than new features, select Stable instead. Review the NGINX changelog and test your configuration before switching between streams.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Check Ubuntu and CPU support

The nginx.org package page currently lists Ubuntu 22.04 (jammy), 24.04 (noble) and 26.04 (resolute) for x86_64 and arm64. Confirm that your host matches one of those combinations before adding a repository. The commands below show the codename and Debian architecture name that APT will use.

lsb_release -a
lsb_release -cs
dpkg --print-architecture
uname -m

On a 64-bit Intel or AMD machine, dpkg --print-architecture normally prints amd64; on a 64-bit ARM machine it prints arm64. Do not substitute a codename by guesswork: an unsupported codename can leave APT unable to find packages or mixing repositories you did not intend to use. If your release is not listed by the current nginx.org package service, use Ubuntu’s repository or wait until that release is published.

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

Install prerequisites

Refresh the package index and install the tools needed to download, verify and use a repository signing key.

sudo apt update
sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring
  • curl retrieves the published key.
  • gnupg2 converts and inspects the keyring.
  • ca-certificates enables certificate validation for HTTPS downloads.
  • lsb-release supplies the Ubuntu codename used in the repository entry.
  • ubuntu-keyring provides Ubuntu’s trusted package-key material.

Import and verify the official signing key

Store the key in a dedicated keyring instead of adding it to the deprecated global APT key collection. The URL below is the key published by NGINX.

curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor 
  | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null

Inspect the resulting keyring before allowing APT to trust it:

gpg --dry-run --quiet --no-keyring --import --import-options import-show 
  /usr/share/keyrings/nginx-archive-keyring.gpg

The output should contain the complete fingerprints published by NGINX:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • 8540A6F18833A80E9C1653A42FD21310B49F6B46
  • 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
  • 9E9BE90EACBCDE69FE9B204CBCDCD8A38D88A2B3

If the fingerprints do not match exactly, remove the keyring and stop rather than continuing with an unverified repository:

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
sudo rm -f /usr/share/keyrings/nginx-archive-keyring.gpg

NGINX’s package documentation lists the legacy signing key with an expiry of 2027-05-24. Recheck the current package documentation when that date approaches or whenever the published fingerprints change.

Add either the Stable or Mainline repository

Stable stream

Use this entry when you want the conservative official stream:

echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] 
  https://nginx.org/packages/ubuntu `lsb_release -cs` nginx" 
  | sudo tee /etc/apt/sources.list.d/nginx.list

The repository path is https://nginx.org/packages/ubuntu. The backtick command inserts your machine’s Ubuntu codename, such as jammy or noble.

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

Mainline stream

Mainline is the appropriate stream when the goal is the latest upstream release:

echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] 
  https://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" 
  | sudo tee /etc/apt/sources.list.d/nginx.list

The Mainline repository is https://nginx.org/packages/mainline/ubuntu. Add only one of these entries to /etc/apt/sources.list.d/nginx.list; leaving both streams enabled creates an avoidable version-selection conflict.

Pin nginx.org so APT selects it

A pin gives packages whose origin is nginx.org a priority of 900. That makes the intended official repository win when Ubuntu and nginx.org offer different versions, while still allowing APT’s normal dependency rules to apply.

echo -e "Package: *nPin: origin nginx.orgnPin: release o=nginxnPin-Priority: 900n" 
  | sudo tee /etc/apt/preferences.d/99nginx

Refresh package metadata and inspect the candidate before installing:

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.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
sudo apt update
apt-cache policy nginx

In the policy output, check that the candidate comes from the nginx.org entry you selected. If APT reports a missing Release file, an unsupported codename, a signature error or no candidate version, fix that problem before running the install command.

Install NGINX from the official repository

Install the package after the key, repository and pin are in place:

sudo apt install nginx

Ubuntu’s package integration may start the service during installation. If it is not running, start it explicitly:

sudo systemctl enable --now nginx

The package installs the NGINX executable, a systemd service definition, the default document root and the standard configuration tree. Enabling the service makes it start automatically on subsequent boots; starting it immediately lets you test the installation without rebooting.

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

Verify the service and exact installed version

Check systemd state

sudo systemctl status nginx --no-pager

Look for an active (running) state. For a concise health check, use:

sudo systemctl is-active nginx

Make a local HTTP request

curl -I 127.0.0.1

A correctly responding default server returns an HTTP header block; the NGINX documentation’s example shows HTTP/1.1 200 OK. Testing the loopback address avoids DNS, firewall and external load-balancer variables, so it confirms that the local process is accepting HTTP connections.

If you started NGINX manually with sudo nginx and systemd is also configured to manage it, do not launch a second copy. A duplicate process normally fails because port 80 is already bound. Use sudo systemctl restart nginx for a service-managed restart instead.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Read the installed version

sudo nginx -v

The command prints the exact binary version installed on your host. NGINX documentation displayed nginx/1.31.7 in an example accessed on 2026-10-15, but that is not a promise for your system: repository metadata changes as new packages are published. Treat your command output and current APT candidate as authoritative.

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

Stable versus Mainline: which stream should you run?

Consideration Mainline Stable
Release position Current upstream release stream Conservative upstream stream
Feature timing New capabilities arrive sooner Features arrive later after additional maturation
Operational posture Requires more frequent compatibility checks Slower change rate suits tightly controlled production environments
“Latest version” requests Natural choice Not the newest upstream build

Mainline is not a different product; it is a release channel. Before selecting it for a critical service, validate third-party modules, TLS settings, automation and application behavior against the version you will receive. Stable is preferable when your operational policy values fewer changes over immediate access to upstream features. Whichever stream you choose, monitor updates and test configuration changes before applying them to every server.

Use Ubuntu’s repository instead

If distribution integration and minimal repository administration are more important than receiving the newest upstream package immediately, Ubuntu’s own instructions are sufficient:

sudo apt update && sudo apt install nginx

Ubuntu documents this command as installing dependencies and starting the web server. Verify what you received rather than assuming a version:

sudo nginx -v
sudo systemctl status nginx --no-pager
curl -I 127.0.0.1

This route uses Ubuntu’s update and security-maintenance workflow. It is a sound choice for learning environments, standardised fleet images and systems where the distribution’s dependency integration matters more than the newest NGINX release. You can switch later, but remove or disable conflicting repository entries and test the resulting configuration before changing a production host.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Know the important files and commands

Primary configuration

The main configuration file is /etc/nginx/nginx.conf. It commonly includes files from subordinate directories, so inspect the include directives before assuming that every setting lives in the main file. Keep a backup of the working configuration before editing:

sudo cp -a /etc/nginx /etc/nginx.backup.$(date +%Y%m%d%H%M%S)

Logs

By default, access requests are recorded in /var/log/nginx/access.log and errors in /var/log/nginx/error.log. Follow the error log while testing a change:

sudo tail -f /var/log/nginx/error.log

Use the access log to confirm that requests reach NGINX and the error log to diagnose configuration parsing, permission and upstream-proxy failures.

Configuration validation and reload

Validate syntax before reloading a live service:

sudo nginx -t
sudo systemctl reload nginx

A reload applies a valid configuration without stopping existing workers. If validation fails, correct the reported file and line, rerun nginx -t, and only then reload. Keep the previous backup until the new configuration has served real test requests.

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

Optional dynamic modules

When a module is packaged for your selected stream, its package name follows the pattern nginx-module-<NAME>. Install only modules that your configuration needs, and verify that the module build matches the NGINX stream and version on the host.

Troubleshoot common installation failures

APT cannot find a package or repository metadata

  • Run lsb_release -cs and compare the result with the codenames currently published by nginx.org.
  • Check that /etc/apt/sources.list.d/nginx.list contains only the Stable or Mainline entry you intended.
  • Run sudo apt update and read the first error; do not hide signature or Release-file failures by repeatedly retrying.
  • Use apt-cache policy nginx to confirm that a candidate version exists and identify its origin.

Signature or fingerprint errors

Confirm that the repository entry references /usr/share/keyrings/nginx-archive-keyring.gpg and that the key file contains one of the three full fingerprints listed earlier. If the fingerprints differ, delete the keyring, obtain the current key from https://nginx.org/keys/nginx_signing.key, verify the newly published fingerprints, and only then rerun APT.

The wrong stream is being selected

Inspect both the source file and policy output. Remove the unintended stream entry, keep the pin file, run sudo apt update, and review the candidate version before changing packages. Switching streams can introduce configuration or module compatibility changes, so test with sudo nginx -t and stage the upgrade where possible.

The service will not start

First inspect the service journal and NGINX’s error log:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl status nginx --no-pager
sudo journalctl -u nginx -n 50 --no-pager
sudo tail -n 50 /var/log/nginx/error.log

Then run sudo nginx -t. A syntax error, a port already occupied by another process, an unavailable certificate file or an invalid module is more useful to fix than repeatedly restarting the service. If a manually launched process is holding port 80, stop that process or return management to systemd before starting the packaged service.

Local curl works but remote requests fail

A successful request to 127.0.0.1 proves that NGINX is listening locally, not that the host is reachable from the internet. Check the server’s network firewall, cloud security rules, DNS record and whether your server block listens on the expected address and port. Use the access and error logs while making a remote request to distinguish network blocking from an NGINX configuration problem.

Maintain the installation safely

Keep the repository and pin under configuration management so another administrator can reproduce the source and priority. Apply updates through APT, review the candidate version and read the NGINX changelog for changes that could affect modules or directives. Before a production upgrade, copy the configuration, run sudo nginx -t, exercise a staging endpoint and retain a rollback plan based on your package-management policy.

Do not edit the downloaded keyring by hand or bypass signature verification to force an installation. Repository authentication, a verified fingerprint and an explicit APT pin are the controls that ensure the package you install comes from the source you selected.

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

Installation checklist

  • Ubuntu codename and architecture are listed by the current nginx.org package service.
  • Prerequisites are installed and HTTPS certificate validation works.
  • The signing key is stored in /usr/share/keyrings/nginx-archive-keyring.gpg and its fingerprint matches the published values.
  • Exactly one nginx.org stream is present in /etc/apt/sources.list.d/nginx.list.
  • /etc/apt/preferences.d/99nginx gives nginx.org a priority of 900.
  • apt-cache policy nginx shows the intended repository as the candidate.
  • sudo nginx -v records the actual installed version.
  • curl -I 127.0.0.1, systemd status and sudo nginx -t all succeed.
  • Configuration backups and the access and error log paths are known before making changes.

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 from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

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.