在Debian 9上,通过官方软件存储库安装最新版本的Nginx主线版

首先

使用公式存储库在Debian9上安装Nginx主线最新版本
原文链接:Nginx安装方法和EOL总结
参考链接:nginx: Linux软件包

支持

如果使用这种方法进行引入,我认为将会得到支持,直到nginx的开发停止。
如果不指定特定版本,我认为将始终提供最新的mainline版本。

记录

注册存储库

# apt update; apt install -y curl gnupg2 ca-certificates lsb-release
# echo "deb http://nginx.org/packages/mainline/debian `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
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

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

各种确认

# which nginx
/usr/sbin/nginx

# nginx -v
nginx version: nginx/1.17.4

# apt show nginx
Package: nginx
Version: 1.17.4-1~stretch
Priority: optional
Section: httpd
Maintainer: Sergey Budnevitch <sb@nginx.com>
Installed-Size: 3010 kB
Provides: httpd
Depends: init-system-helpers (>= 1.18~), libc6 (>= 2.17), libpcre3, libssl1.1 (>= 1.1.0), 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: 845 kB
APT-Manual-Installed: yes
APT-Sources: http://nginx.org/packages/mainline/debian stretch/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 are 33 additional records. Please use the '-a' switch to see them.