Upgrade on Ubuntu#
Prerequisites + signing key#
sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring
curl -s https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
| sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
Add the stable nginx.org repo (resolute suite)#
Stable#
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
Mainline#
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
Pin nginx.org above Ubuntu’s archive#
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
| sudo tee /etc/apt/preferences.d/99nginx
Update & verify candidate#
sudo apt update
apt-cache policy nginx
Backup and Install#
sudo cp -a /etc/nginx /root/nginx-backup-$(date +%F)
sudo apt install nginx