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 

Nếu có thắc mắc, bạn hãy liên hệ hotline 1800 109307 088 44444 để được hỗ trợ giải đáp nhanh chóng. Chúc các bạn thực hiện thành công.

BÀI VIẾT LIÊN QUAN

  1. Các gói Hosting tại Vietnix + Mã giảm giá
  2. Hướng dẫn cài đặt DirectAdmin trên CentOS, Ubuntu
  3. 6 bước tạo Subdomain trên VPS Ubuntu nhanh nhất
  4. Lưu iptables rules trên Ubuntu

VIETNIX - DỊCH VỤ HOSTING, VPS TỐC ĐỘ CAO