强曰为道
与天地相似,故不违。知周乎万物,而道济天下,故不过。旁行而不流,乐天知命,故不忧.
文档目录

Nginx 从入门到精通

Nginx 从入门到精通 / Nginx: From Beginner to Expert

一套由浅入深的 Nginx 完整教程,每个场景纵向穿透。 A comprehensive Nginx tutorial — each topic drilled from surface to core.


目录 / Table of Contents

#章节 / Chapter关键词 / Keywords
1初识 Nginx / IntroductionWhat, Why, Architecture
2安装与部署 / Installation & Deploymentapt, yum, compile, systemd
3静态文件服务 / Static File Servingroot, alias, try_files, autoindex
4Location 路由匹配 / Location Matchingprefix, regex, priority, rewrite
5反向代理 / Reverse Proxyproxy_pass, headers, WebSocket
6负载均衡 / Load Balancingupstream, strategies, health_check, sticky
7HTTPS 与 TLS / HTTPS & TLSSSL, Let’s Encrypt, OCSP, HSTS
8缓存机制 / Cachingproxy_cache, microcaching, purge
9日志与监控 / Logging & Monitoringaccess_log, error_log, stub_status, Prometheus
10安全加固 / Security Hardeningheaders, rate_limit, WAF, access control
11性能调优 / Performance Tuningworker, keepalive, buffer, gzip, tuning
12Lua 扩展与 OpenResty / Lua & OpenRestyLua, OpenResty, access_by_lua, WAF

阅读建议 / How to Read

  • 初学者 / Beginners: 从第 1 章开始,按顺序阅读 / Start from Chapter 1, read in order.
  • 有经验者 / Experienced: 直接跳到感兴趣的章节 / Jump to the chapter you need.
  • 查阅用途 / Reference: 每章独立成文,可按需查阅 / Each chapter is self-contained.

每章结构 / Chapter Structure:

  • 🟢 基础 — 最简单的用法 / Basic — simplest usage
  • 🟡 进阶 — 生产环境常见配置 / Intermediate — production-ready
  • 🔴 高级 — 深入原理与极限用法 / Advanced — internals & edge cases

Nginx 在技术栈中的位置 / Where Nginx Fits

                        Internet
                           │
                     ┌─────┴─────┐
                     │  Nginx    │  ← 反向代理 / 负载均衡 / SSL 终止
                     │  (Layer7) │     Reverse Proxy / LB / SSL Termination
                     └─────┬─────┘
                           │
            ┌──────────────┼──────────────┐
            │              │              │
      ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐
      │  App 1    │ │  App 2    │ │  App 3    │
      │ (Node.js) │ │ (Python)  │ │ (Go)      │
      └───────────┘ └───────────┘ └───────────┘
            │              │              │
            └──────────────┼──────────────┘
                           │
                     ┌─────┴─────┐
                     │  Database  │
                     │  (MySQL)   │
                     └───────────┘