Nginx中文文档
DocsHome
  • 贡献导引
  • 介绍
    • 安装 nginx
    • 从源码构建 nginx
    • 初学者指南
    • 管理指南
    • 控制 nginx
    • 连接处理方式
    • 设置哈希
    • 调试日志
    • 记录日志到 syslog
    • 配置文件度量单位
    • 命令行参数
    • Windows 下的 nginx
    • QUIC 和 HTTP/3 支持
    • nginx 如何处理请求
    • 服务器名称
    • 使用 nginx 作为 HTTP 负载均衡器
    • 配置 HTTPS 服务器
    • nginx 如何处理 TCP/UDP 会话
    • 关于 nginScript
  • 其他
    • Linux 软件包
  • How-To
    • 在 Win32 平台上使用 Visual C 构建 nginx
    • 设置 Amazon EC2 的 Nginx Plus 环境
    • 使用 DTrace pid 提供程序调试 nginx
    • 转换重写规则
    • WebSocket 代理
  • 开发
    • 贡献指南
    • 开发指南
  • 模块参考
  • 核心功能
    • HTTP
      • ngx_http_core_module
      • ngx_http_access_module
      • ngx_http_addition_module
      • ngx_http_api_module
      • ngx_http_auth_basic_module
      • ngx_http_auth_jwt_module
      • ngx_http_auth_request_module
      • ngx_http_autoindex_module
      • ngx_http_browser_module
      • ngx_http_charset_module
      • ngx_http_dav_module
      • ngx_http_empty_gif_module
      • ngx_http_f4f_module
      • ngx_http_fastcgi_module
      • ngx_http_flv_module
      • ngx_http_geo_module
      • ngx_http_geoip_module
      • ngx_http_grpc_module
      • ngx_http_gunzip_module
      • ngx_http_gzip_module
      • ngx_http_gzip_static_module
      • ngx_http_headers_module
      • ngx_http_hls_module
      • ngx_http_image_filter_module
      • ngx_http_index_module
      • ngx_http_js_module
      • ngx_http_keyval_module
      • ngx_http_limit_conn_module
      • ngx_http_limit_req_module
      • ngx_http_log_module
      • ngx_http_map_module
      • ngx_http_memcached_module
      • ngx_http_mirror_module
      • ngx_http_mp4_module
      • ngx_http_perl_module
      • ngx_http_proxy_module
      • ngx_http_random_index_module
      • ngx_http_realip_module
      • ngx_http_referer_module
      • ngx_http_rewrite_module
      • ngx_http_scgi_module
      • ngx_http_secure_link_module
      • ngx_http_session_log_module
      • ngx_http_slice_module
      • ngx_http_spdy_module(过时)
      • ngx_http_split_clients_module
      • ngx_http_ssi_module
      • ngx_http_ssl_module
      • ngx_http_status_module(过时)
      • ngx_http_stub_status_module
      • ngx_http_sub_module
      • ngx_http_upstream_module
      • ngx_http_upstream_conf_module
      • ngx_http_upstream_hc_module
      • ngx_http_userid_module
      • ngx_http_uwsgi_module
      • ngx_http_v2_module
      • ngx_http_xslt_module
    • Mail
      • ngx_mail_core_module
      • ngx_mail_auth_http_module
      • ngx_mail_proxy_module
      • ngx_mail_ssl_module
      • ngx_mail_imap_module
      • ngx_mail_pop3_module
      • ngx_mail_smtp_module
    • Stream
      • ngx_stream_core_module
      • ngx_stream_access_module
      • ngx_stream_geo_module
      • ngx_stream_geoip_module
      • ngx_stream_js_module
      • ngx_stream_keyval_module
      • ngx_stream_limit_conn_module
      • ngx_stream_log_module
      • ngx_stream_map_module
      • ngx_stream_proxy_module
      • ngx_stream_realip_module
      • ngx_stream_return_module
      • ngx_stream_split_clients_module
      • ngx_stream_ssl_module
      • ngx_stream_ssl_preread_module
      • ngx_stream_upstream_module
      • ngx_stream_upstream_hc_module
      • ngx_stream_zone_sync_module
    • 其他
      • ngx_google_perftools_module
由 GitBook 提供支持
在本页
  • nginx:Linux 软件包
  • 稳定版本的预构建软件包
  • 主线版本的预构建软件包
  • 源码包
  • 动态模块
  • 签名
  • 原文档
  1. 其他

Linux 软件包

nginx:Linux 软件包

目前,nginx 软件支持以下 Linux 发行版:

RHEL/CentOS:

版本

支持平台

6.x

x86_64,i386

7.x

x86_64,ppc64le

Debian:

版本

代号

支持平台

7.x

wheezy

x86_64,i386

8.x

jessie

x86_64,i386

9.x

stretch

x86_64,i386

Ubuntu:

版本

代号

支持平台

12.04

precise

x86_64,i386

14.04

trusty

x86_64,i386, aarch64/arm64

16.04

xenial

x86_64,i386, ppc64el,aarch64/arm64

16.10

yakkety

x86_64,i386

SLES:

版本

支持平台

12

x86_64

要启用 Linux 软件包的自动更新,可设置 RHEL/CentOS 发行版的 yum 仓库(repository),Debian/Ubuntu 发行版的 apt 仓库或 SLES 的 zypper 仓库。

稳定版本的预构建软件包

要设置 RHEL/CentOS 的 yum 仓库,请创建名为 /etc/yum.repos.d/nginx.repo 的文件,其中包含以下内容:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

根据所使用的发行版,使用 rhel 或 centos 替换掉 OS,对于 6.x 或 7.x 版本,将 OSRELEASE 替换为 6 或 7。

sudo apt-key add nginx_signing.key

对于 Debian,使用 Debian 发行版代号替换掉 codename,并将以下内容追加到 /etc/apt/sources.list 文件末尾:

deb http://nginx.org/packages/debian/ codename nginx
deb-src http://nginx.org/packages/debian/ codename nginx

对于 Ubuntu,使用 Ubuntu 发行版代号替换掉 codename,并将以下内容追加到 /etc/apt/sources.list 文件末尾:

deb http://nginx.org/packages/ubuntu/ codename nginx
deb-src http://nginx.org/packages/ubuntu/ codename nginx

对于 Debian/Ubuntu,请运行以下命令:

apt-get update
apt-get install nginx

对于 SLES,运行以下命令:

zypper addrepo -G -t yum -c 'http://nginx.org/packages/sles/12' nginx

主线版本的预构建软件包

要设置 RHEL/CentOS 的 yum 仓库,请创建名为 /etc/yum.repos.d/nginx.repo 的文件,其中包含以下内容:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

根据所使用的发行版,使用 rhel 或 centos 替换掉 OS,对于 6.x 或 7.x 版本,将 OSRELEASE 替换为 6 或 7。

sudo apt-key add nginx_signing.key

对于 Debian,使用 Debian 发行版代号替换 codename,并将以下内容追加到 /etc/apt/sources.list 文件末尾:

deb http://nginx.org/packages/mainline/debian/ codename nginx
deb-src http://nginx.org/packages/mainline/debian/ codename nginx

对于 Ubuntu,使用 Ubuntu 发行版代号替换 codename,并将以下内容追加到 /etc/apt/sources.list 文件末尾:

deb http://nginx.org/packages/mainline/ubuntu/ codename nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ codename nginx

对于 Debian/Ubuntu,请运行以下命令:

apt-get update
apt-get install nginx

对于 SLES,请运行以下命令:

zypper addrepo -G -t yum -c 'http://nginx.org/packages/mainline/sles/12' nginx

源码包

default 分支保存当前主线版本的源码包,而 stable-* 分支包含了稳定版本的最新源码。要构建二进制包,请在 Debian/Ubuntu 上的 debian/ 目录或在 RHEL/CentOS/SLES 上的 rpm/SPECS/ 中运行 make。

动态模块

nginx-module-geoip
nginx-module-image-filter
nginx-module-njs
nginx-module-perl
nginx-module-xslt

签名

在 Debian/Ubuntu 上:

sudo apt-key add nginx_signing.key

在 RHEL/CentOS 上;

sudo rpm --import nginx_signing.key

在 SLES 上:

sudo rpm --import nginx_signing.key

Debian/Ubuntu/SLES 签名默认情况被检查,但是在 RHEL/CentOS 上,需要在 /etc/yum.repos.d/nginx.repo 文件中进行设置:

gpgcheck= 1

原文档

上一页其他下一页How-To

最后更新于5年前

对于 Debian/Ubuntu,为了验证 nginx 仓库签名,并且在安装 nginx 软件包时消除关于缺少 PGP 密钥的警告,需要将用于将 nginx 软件包和仓库签署的密钥添加到 apt 程序密钥环中。请从我们的网站下载此,并使用以下命令将其添加到 apt 程序密钥环:

对于 Debian/Ubuntu,为了验证 nginx 仓库签名,并且在安装 nginx 软件包时消除关于缺少 PGP 密钥的警告,必须将用于将 nginx 软件包和仓库签署的密钥添加到 apt 程序密钥环中。请从我们的网站下载此 ,并使用以下命令将其添加到 apt 程序密钥环:

源码包可以在 中找到。

源码包在 下发行,与 nginx 相同。

主 nginx 包使用了所有模块进行构建,没有使用到附加库,以避免额外的依赖。自 1.9.11 版本开始,nginx 支持 ,并将以下模块构建为动态模块,以独立软件包的形式发布:

RPM 软件包和 Debian/Ubuntu 仓库都使用数字签名来验证下载包的完整性和来源。为了检查签名,需要下载 并将其导入 rpm 或 apt 程序密钥环:

由于我们的 和软件包都位于同一台服务器上,因此它们都是可信的。强烈建议另行验证下载的 PGP 密钥的真实性。PGP 具有“Web of Trust”(信任网络)的概念,当一个密钥是由别人的密钥签署的,而另一个密钥则由另一个密钥签名。它通常可以建立一个从任意密钥到您知道和信任的某人的密钥,从而验证链中第一个密钥的真实性。这个概念在 中有详细描述。我们的钥匙有足够的签名,其真实性比较容易检查。

密钥
密钥
源码包库
类 BSD 的两项条款许可证
动态模块
nginx 签名密钥
PGP 密钥
GPG Mini Howto
http://nginx.org/en/linux_packages.html#distributions