在Ubuntu 20.04上安装Nginx稳定版的最新版本(官方仓库)

首先

使用公式存储库将最新稳定版本的 Nginx 安装到 Ubuntu 20.04 上。
原文链接:Nginx各种安装方法和EOL概述
参考链接:nginx:Linux 包

支持

如果使用此方法进行导入,我认为将受到支持直到nginx开发停止。
如果不指定特定版本,我认为将始终提供最新的稳定版。

日志

将资源库注册

# apt update; apt install -y curl gnupg2 ca-certificates lsb-release
# echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list
# curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add -

# apt-key fingerprint ABF5BD827BD9BF62
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 <signing-key@nginx.com>

安装

# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

# apt update; apt install -y nginx
... 略

各种确认 (gè

# which nginx
/usr/sbin/nginx

# nginx -v
nginx version: nginx/1.18.0

# apt show nginx
Package: nginx
Version: 1.18.0-1~focal
Priority: optional
Section: httpd
Maintainer: Sergey Budnevitch <sb@nginx.com>
Installed-Size: 3058 kB
Provides: httpd
Depends: libc6 (>= 2.28), libcrypt1 (>= 1:4.1.0), libpcre3, libssl1.1 (>= 1.1.1), zlib1g (>= 1:1.1.4), lsb-base (>= 3.0-6), adduser
Conflicts: nginx-common, nginx-core
Replaces: nginx-common, nginx-core
Homepage: http://nginx.org
Download-Size: 857 kB
APT-Manual-Installed: yes
APT-Sources: http://nginx.org/packages/ubuntu focal/nginx amd64 Packages
Description: high performance web server
 nginx [engine x] is an HTTP and reverse proxy server, as well as
 a mail proxy server.

N: There is 1 additional record. Please use the '-a' switch to see it
广告
将在 10 秒后关闭
bannerAds