Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Derek DeJonghe

Rating No ratings yet

NGINX 是当今使用最广泛的 Web 服务器之一,部分原因在于 它可以用作 HTTP 和其他网络协议的负载均衡器和反向代理服务 器。本修订版完全指南通过一些简单易懂的例子解析了应用交 付中真实存在的问题。实用的实操指南可帮助您设置开源或商 业产品,并利用它们解决各种用例中的问题。 对于了解现代 Web 架构(例如 n 层或微服务设计以及 TCP 和 HTTP 等常见 Web 协议)的专业人士来说,本书的这些实操指 南为安全和软件负载均衡以及 NGINX 应用交付平台的监控和维 护提供了经过验证的解决方案。您还将了解到免费的 NGINX 开 源版以及许可授权版 NGINX Plus 的高级功能。

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on recipe collection for engineers who already understand modern web architecture and now need to configure NGINX (open source or Plus) for real application-delivery problems—load balancing, security, caching, cloud/container deployment, and operations. Best for practitioners who want working configurations and the reasoning behind them, not a from-zero tutorial. 【Book Arc】 - **Opening (~0%–13%)**: Installation and fundamentals—setting up NGINX on Debian/Ubuntu and RedHat/CentOS, installing NGINX Plus, verifying the install, and learning the key files, directories, and commands. Solves the "get it running and know where things live" problem. - **Early (~13%–33%)**: Core delivery mechanics—HTTP/TCP/UDP load balancing, session persistence, health checks, traffic management (A/B testing, GeoIP, rate/connection/bandwidth limits), large-scale caching, and programmability/automation (Plus API, key-value store, njs, Chef/Ansible/Consul). - **Middle (~33%–53%)**: Security and modern protocols—authentication (basic auth, subrequests, JWT, OpenID Connect), access control and TLS, HTTP/2 and gRPC, plus media streaming (MP4/FLV, HLS/HDS). - **Late (~53%–67%)**: Deployment environments—cloud (AWS, Azure, Google Compute Engine), containers and microservices (API gateway, Docker images, Kubernetes Ingress, service mesh/mTLS), high-availability patterns, and monitoring. - **Ending (~67%–100%)**: Operations and tooling—logging and request tracing, performance tuning, NGINX Instance Manager and Controller, and practical ops tips like includes and config debugging. 【Key Takeaways】 - **This is a cookbook, not a linear textbook** (Early): each section is framed as problem → solution → explanation, so it works best as a reference you jump into by task. - **Load balancing spans HTTP, TCP, and UDP** (Early): the `upstream` pattern recurs across the `http` and `stream` contexts, with algorithms like round-robin, least connections, and Plus-only least-time. - **Session persistence is a first-class concern** (Early): NGINX Plus offers sticky cookie, sticky learn, and sticky routing for stateful applications where requests must return to the same server. - **Health checks split into passive (open source) and active (Plus)** (Early): passive checks watch live traffic, while active checks probe upstreams proactively to avoid client-facing failures. - **NGINX is often the first security boundary** (Middle): the book treats authentication, TLS, access control, and WAF/DDoS protection as core delivery concerns, not add-ons. - **Caching and traffic management are tunable levers** (Early): cache zones, locking, hash keys, bypass, and slicing, alongside rate, connection, and bandwidth limits. - **Cloud, containers, and service mesh are covered as deployment targets** (Late): AWS/Azure/GCP patterns, Docker images, Kubernetes Ingress, and mTLS mesh setups. - **Operations close the loop** (Ending): logging, tracing, performance tuning, and management tooling (Instance Manager, Controller) round out the lifecycle. 【Reading Tips】 - Use the table of contents as your entry point: jump straight to the chapter matching your current task rather than reading cover to cover. - Deep-read the load balancing, security, and caching chapters—these are the highest-leverage for production delivery work. - Skim the installation and cloud-provider chapters if you already have a working environment; return when migrating platforms. - Watch for the recurring "NGINX Plus only" annotations—many advanced features (active health checks, least-time, JWT, sticky sessions) are not in the open source edition. - Treat the config snippets as starting points and always validate with `nginx -t` before reloading. 【Coverage Limits】 This guide is synthesized from stratified excerpts covering the front matter, table of contents, and early-to-mid chapters; later chapters on Instance Manager, Controller, and detailed ops tips are only visible at the heading level, so their specific content is not summarized here.
Page 4
Kim Cofer 英文版校对:JM Olejarz O'Reilly 徽标是 O'Reilly Media, Inc. 的注册商标。《NGINX 完全指南》、封面图片和相关商业包 装是 O'Reilly Media, Inc. 的商标。 本书所述均为作者的个人观点,不代表出版商的立场。虽然出版商和作者已经做出了...
View in text
Excerpt 2
....................................................... 181 ix前言 前言 《NGINX 完全指南》旨在通过一些简单易懂的例子解析应用交付中真实存在的问题。 本书内容丰富全面,探讨了 NGINX 的大部分主要特性,可帮助您学习如何使用这些 功能。 本书涉...
View in text
Page 17
GINX Plus 仓库进行身份验证。 详解 NGINX 会及时更新这个仓库安装指南和 NGINX Plus 安装说明。这些说明因您的操作 系统和版本而略有不同,但都有一个共同点:您必须从 NGINX 门户获取证书和密钥并 提供给您的系统,以便对 NGINX Plus 仓库进行身份验证。 1.4 验证安装 问题...
View in text
Page 25
06 weight=5; server read2.example.com:3306; server 10.10.12.34:3306 backup; } server { listen 3306; proxy_pass mysql_read; } } 此示例中的 server 代码块指示 NGINX 侦听 TC...
View in text
Page 30
发哈 希请求。此算法有一个可选的参数:consistent,它能够将重新分发带来的影响最 小化。其指令名称是 hash。 随机 该方法用于指示 NGINX 从组中随机选择一台服务器,同时考虑服务器的权重。可 选的 two [method] 参数指示 NGINX 随机选择两台服务器,然后使用提供的负载 均衡方法对两...
View in text
Page 36
仅仅是响应代码。在 NGINX Plus 中,主动 HTTP 健康检查根据一系列有关上游服 务器响应的接受标准实施监控。您可以对主动健康检查的监控进行配置,包括上游服 务器的检查频率、服务器必须通过多少次检查才能被视为健康、失败多少次会被视为 不健康以及预期的结果应该是什么。对于更复杂的逻辑,match 代码块的...
View in text
Page 40
误后带来的 影响。更常见的部署模式是蓝绿部署,也就说在将用户切换到新版本的同时,仍然保 持旧版本在验证部署期间的可用性。无论出于何种原因在两组不同的应用之间分割客 户端流量,NGINX 的 split_client 模块都可以帮您轻松搞定。 其他参考资料 split_clients 模块文档 http { spl...
View in text
Tags
AI categories
BackendDevOpsCloud Native
nginx
ISBN: 1098126246
Publisher: O'Reilly
Publish Year: 2022
Language: English
Pages: 205
File Format: PDF
File Size: 7.3 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…