How to upgrade NGINX to the latest stable version

In this tutorial we will explain how to upgrade your NGINX version to the latest stable version

Note: all these commands have to be run as root user, please be sure you are logged in as root user.

Start by adding the NGINX stable repository:

add-apt-repository ppa:nginx/stable

Next update the packages list:

apt update

And finally run the actual package updates:

apt dist-upgrade

This command "dist-upgrade" might raise some questions on config changes, you can keep your current files by just pressing "enter", this is the most safest option to do so.

Next verify your NGINX version:

nginx -v

And also restart NGINX to be sure it is OK:

service nginx restart
17 January 2020