Installation
Install using distro's repositories
On Ubuntu
Install using official repositories
On Ubuntu
These steps comes from Official nginx documentation1
From a bash prompt, start installing prerequisites
Then, import official packages' GPG key
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | \
sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
Optional: GPG Key Verification
If you want to be sure that the GPG key is correct, run this command:
Expected output has to contain this:Enable apt repository for official stable packages:
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list
Setup priority for the newly added repository over Ubuntu's official repos
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
| sudo tee /etc/apt/preferences.d/99nginx
When done, start installation with: