Install Nginx Mainline on openSUSE Leap – the Quick‑Start Guide
Want the bleeding‑edge features of Nginx without wrestling with source code?
This post shows you how to pull the latest mainline build straight from an official repository into your openSUSE Leap system, and why it’s worth the extra step.
Why use the mainline version?
The stable release gets a few updates per year; the mainline line is updated every six weeks with new modules, bug fixes, and performance tweaks. I’ve seen servers that needed the latest TLS 1.3 support or the ngx_http_quic_module just come up dead when stuck on an older binary. Installing mainline keeps you in sync with upstream without manually compiling.
Step 1: Add the official Nginx repo
sudo zypper ar -cf https://nginx.org/packages/opensuse/leap/openSUSE-Leap-15.5/nginx.repo nginx
zypper ar registers a new repository; -c forces overwrite if the file exists and -f tells zypper to refresh it automatically. The URL points directly at Nginx’s own repo for Leap 15.5, so you get the right binaries.
Step 2: Import the GPG key
sudo rpm --import https://nginx.org/keys/nginx_signing.key
Without the key zypper will refuse to install anything from that repo, calling it “untrusted.” Importing once is all you need; after that the signature checks are automatic.
Step 3: Refresh and install
sudo zypper refresh nginx sudo zypper install nginx
refresh pulls the newest package metadata. install brings in the mainline build plus any dependencies (like libpcre3, libssl1_1). If you already have the stable Nginx installed, this command will upgrade it to mainline instead of keeping two copies.
Step 4: Verify the version
nginx -v
Output should look like:
nginx version: nginx/1.26.x
The “1.26” (or newer) number confirms you’re running the mainline branch, not the 1.20‑stable line.
Optional tweak: Keep it on autopdate
If you want zypper to pull new mainline releases automatically, edit the repo file:
sudo nano /etc/zypp/repos.d/nginx.repo
Add or change this line inside the [nginx] section:
autorefresh = true
Now every zypper update will grab the latest mainline patch for you.
Common pitfalls
- Wrong Leap version in URL – If you’re on 15.4, swap “15.5” for “15.4”. A mismatched repo can produce “package not found” errors or broken dependencies.
- Cache stale after repo change – Run zypper clean --all if you see odd package versions or broken links.