Skip to content

Dashboard

Hướng dẫn upgrade Nginx trên Ubuntu

Created by Admin

Bài viết sẽ hướng dẫn các bạn cách upgrade Nginx trên Ubuntu theo các bước đơn giản nhất.

Kiểm tra phiên bản NGINX hiện tại

nginx -v

Output

nginx version: nginx/1.18.0 (Ubuntu)

Backup NGINX config

mkdir /etc/nginx-backup/
cp -r /etc/nginx/* /etc/nginx-backup/

Thêm repository của NGINX

sudo apt-get install software-properties-common
nginx=stable
sudo add-apt-repository ppa:nginx/$nginx

Output:

This PPA contains the latest Stable Release version of the nginx web server software.

The following architectures are supported; if your arch doesn't match this list then the PPA is not supporting that architecture:
* i386
* amd64
* armhf
* arm64
* ppc64el

The following releases of Ubuntu (including in-development releases) are supported in this PPA:
* Trusty (14.04)
* Xenial (16.04)
* Yakkety (16.10)
* Zesty (17.04)
* Artful (17.10 - in development!)

The following releases of Ubuntu are no longer supported, and have had their packages removed from the PPA:
* Lucid (10.04)
* Maverick (10.10)
* Natty (11.04)
* Oneiric (11.10)
* Quantal (11.10)
* Raring (13.04)
* Saucy (13.10)
* Utopic (14.10)
* Vivid (15.04)
* Wily (15.10)
More info: https://launchpad.net/~nginx/+archive/ubuntu/stable
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmphecc_aoy/secring.gpg' created
gpg: keyring `/tmp/tmphecc_aoy/pubring.gpg' created
gpg: requesting key C300EE8C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmphecc_aoy/trustdb.gpg: trustdb created
gpg: key C300EE8C: public key "Launchpad Stable" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK

Upgrade Nginx trên Ubuntu

Upgrade hệ thống sẽ giúp update các phần mềm lên phiên bản mới nhất, bao gồm của việc update NGINX

sudo apt-get update && sudo apt-get upgrade full-upgrade -y

Kiểm tra lại version NGINX sau khi upgrade

nginx -v

Kiểm tra syntax và restart lại dịch vụ NGINX

nginx -t && service nginx restart 
Source: https://vietnix.vn/huong-dan-upgrade-nginx-tren-ubuntu/