01 — APT REPOSITORY
Ubuntu and Debian
Install the mirrored signing key, then add the repository matching your distribution.
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://mirror.sepehrsabz.ir/nginx/packages/keys/nginx_signing.key | sudo gpg --dearmor --yes -o /etc/apt/keyrings/nginx.gpg
sudo chmod a+r /etc/apt/keyrings/nginx.gpgdeb [signed-by=/etc/apt/keyrings/nginx.gpg] https://mirror.sepehrsabz.ir/nginx/packages/ubuntu noble nginxFor Ubuntu 22.04, replace noble with jammy.
deb [signed-by=/etc/apt/keyrings/nginx.gpg] https://mirror.sepehrsabz.ir/nginx/packages/debian bookworm nginxdeb [signed-by=/etc/apt/keyrings/nginx.gpg] https://mirror.sepehrsabz.ir/nginx/packages/debian trixie nginxsudo apt update
sudo apt install -y nginx02 — DNF / YUM REPOSITORY
AlmaLinux, Rocky Linux, and RHEL
[nginx-stable]
name=NGINX Stable - SepehrSabz Mirror
baseurl=https://mirror.sepehrsabz.ir/nginx/packages/rhel/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirror.sepehrsabz.ir/nginx/packages/keys/nginx_signing.key
module_hotfixes=truesudo dnf install -y nginx
sudo systemctl enable --now nginx03 — PACKAGE CHANNELS
Stable or mainline
| Channel | Mirror path | Best fit |
|---|---|---|
| Stable | /nginx/packages/ | Conservative feature cadence |
| Mainline | /nginx/packages/mainline/ | Newest features and fixes |
To use mainline, insert mainline/ after /packages/ in the APT or RPM URL. Do not enable both channels simultaneously.
04 — VERIFY
Confirm the package and service
nginx -v
systemctl --no-pager --full status nginx
curl -I http://127.0.0.1/The local request should return an HTTP response from NGINX. Open TCP ports 80 and 443 in your firewall only as required.
05 — NOTES
Check configuration before every reload. Run
sudo nginx -t, then apply a valid change with sudo systemctl reload nginx.Distribution-provided NGINX packages and nginx.org packages can use different module packaging and defaults. Review existing configurations before switching an already deployed server.