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 / Introduction | What, Why, Architecture |
| 2 | 安装与部署 / Installation & Deployment | apt, yum, compile, systemd |
| 3 | 静态文件服务 / Static File Serving | root, alias, try_files, autoindex |
| 4 | Location 路由匹配 / Location Matching | prefix, regex, priority, rewrite |
| 5 | 反向代理 / Reverse Proxy | proxy_pass, headers, WebSocket |
| 6 | 负载均衡 / Load Balancing | upstream, strategies, health_check, sticky |
| 7 | HTTPS 与 TLS / HTTPS & TLS | SSL, Let’s Encrypt, OCSP, HSTS |
| 8 | 缓存机制 / Caching | proxy_cache, microcaching, purge |
| 9 | 日志与监控 / Logging & Monitoring | access_log, error_log, stub_status, Prometheus |
| 10 | 安全加固 / Security Hardening | headers, rate_limit, WAF, access control |
| 11 | 性能调优 / Performance Tuning | worker, keepalive, buffer, gzip, tuning |
| 12 | Lua 扩展与 OpenResty / Lua & OpenResty | Lua, 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) │
└───────────┘