4

We are currently running nginx on ubuntu, installed version is: 1.10.3-0ubuntu0.16.04.3

Running sudo apt update it reflects that we are on the latest version, however going to nginx.org shows the latest version is 1.17.

How do we upgrade to the latest version?

3 Answers 3

4

Follow the instructions on the Nginx website:

http://nginx.org/en/linux_packages.html#Ubuntu

Install the prerequisites:

sudo apt install curl gnupg2 ca-certificates lsb-release

To set up the apt repository for stable nginx packages, run the following command:

echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list

If you would like to use mainline nginx packages, run the following command instead:

echo "deb http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list

Next, import an official nginx signing key so apt could verify the packages authenticity:

curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -

Verify that you now have the proper key:

sudo apt-key fingerprint ABF5BD827BD9BF62

The output should contain the full fingerprint 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62 as follows:

pub   rsa2048 2011-08-19 [SC] [expires: 2024-06-14]
      573B FD6B 3D8F BC64 1079  A6AB ABF5 BD82 7BD9 BF62
uid   [ unknown] nginx signing key <[email protected]>

To install nginx, run the following commands:

sudo apt update
sudo apt install nginx
2
  • Errors were encountered while processing: /var/cache/apt/archives/nginx_1.18.0-2~xenial_amd64.deb Apr 6, 2021 at 13:19
  • nginx: [emerg] module "/etc/nginx/modules/ngx_http_dav_ext_module.so" version 1016001 instead of 1018000 in /etc/nginx/modules-enabled/50-mod-http-dav-ext.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed Apr 6, 2021 at 15:34
0

The best solution is, Compile Nignx yourself. It will give you the latest updated version.

Compiled packages are not always the updated version, But they focus on the stable version.

0

Follow below commands from the terminal.

cd /tmp

wget http://nginx.org/keys/nginx_signing.key

sudo apt-key add nginx_signing.key

sudo sh -c "echo 'deb http://nginx.org/packages/stable/ubuntu/ '$(lsb_release -cs)' nginx' > /etc/apt/sources.list.d/Nginx.list"

sudo apt-get update

sudo apt-get dist-upgrade

1
  • After doing this I still get the same version?
    – Steve
    May 30, 2019 at 6:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .