Nginx từ Cơ bản đến Nâng cao

Nginx Master Course: From Zero to Hero là khóa học toàn diện giúp bạn làm chủ Nginx từ những khái niệm cơ bản nhất đến các kỹ thuật nâng cao trong môi trường production thực tế.

Nginx từ Cơ bản đến Nâng cao

Bài 1: Giới thiệu và Cài đặt

  • Nginx là gì? Kiến trúc event-driven và non-blocking I/O
  • So sánh Nginx vs Apache
  • Cài đặt Nginx trên Linux (Ubuntu/CentOS), macOS, Windows
  • Cấu trúc thư mục và file cấu hình cơ bản
  • Khởi động, dừng, reload Nginx

Bài 2: Cấu hình cơ bản

  • Cú pháp file cấu hình nginx.conf
  • Context và directive (http, server, location)
  • Cấu hình virtual host (server blocks)
  • Serving static files (HTML, CSS, JS, images)
  • Cấu hình index files và autoindex
  • Error pages tùy chỉnh

Bài 3: Logging và Monitoring

  • Access log và error log
  • Định dạng log tùy chỉnh
  • Log rotation với logrotate
  • Các metrics cơ bản để theo dõi

Bài 4: Reverse Proxy

  • Khái niệm reverse proxy
  • Cấu hình proxy_pass cơ bản
  • Proxy headers (X-Real-IP, X-Forwarded-For)
  • Upstream servers và load balancing
  • Health checks cơ bản

Bài 5: Load Balancing

  • Các thuật toán load balancing (round-robin, least_conn, ip_hash, hash)
  • Cấu hình upstream blocks
  • Backup servers và weight
  • Sticky sessions
  • Active health checks

Bài 6: Caching

  • Browser caching với expires và Cache-Control headers
  • Proxy caching cơ bản
  • FastCGI caching
  • Cache keys và cache zones
  • Cache purging và bypass

Bài 7: SSL/TLS và HTTPS

  • Cấu hình SSL certificate (Let's Encrypt)
  • HTTP to HTTPS redirect
  • SSL protocols và ciphers
  • HSTS (HTTP Strict Transport Security)
  • OCSP Stapling
  • HTTP/2 configuration

Bài 8: Performance Tuning

  • Worker processes và worker connections
  • Keepalive connections
  • Buffer và timeout optimization
  • Gzip compression
  • Sendfile và tcp_nopush
  • Open file cache

Bài 9: Security

  • Rate limiting với limit_req và limit_conn
  • Chặn IP với deny/allow
  • Basic authentication
  • ModSecurity WAF integration
  • Chống DDoS cơ bản
  • Secure headers (CSP, X-Frame-Options, etc.)

Bài 10: Rewrite và Redirects

  • Rewrite rules với regex
  • Return vs rewrite directive
  • Location matching (exact, prefix, regex)
  • Try_files directive
  • Conditional redirects

Bài 11: Nginx với Application Stack

  • PHP-FPM configuration
  • Nginx + Node.js
  • Nginx + Python (uWSGI, Gunicorn)
  • Nginx + Docker containers
  • WebSocket proxying

Bài 12: High Availability

  • Nginx Plus features (nếu có)
  • Active-active và active-passive setup
  • Failover strategies
  • Keepalived cho HA
  • DNS round-robin

Bài 13: Microservices và API Gateway

  • Nginx làm API Gateway
  • Service discovery
  • Circuit breaker patterns
  • JWT authentication
  • API rate limiting per client

Bài 14: Advanced Topics

  • Nginx modules (thêm modules từ bên thứ ba)
  • Lua scripting với OpenResty
  • Nginx streaming (RTMP module)
  • GeoIP filtering
  • Custom error handling
  • A/B testing với Nginx

Bài 15: Monitoring và Troubleshooting

  • Stub status module
  • Nginx Amplify hoặc Prometheus exporter
  • Debug logging
  • Common errors và solutions
  • Performance profiling

Bài 16: Best Practices & Production

  • Configuration management
  • Blue-green deployments
  • Zero-downtime deployments
  • Backup và disaster recovery
  • Security hardening checklist
  • Documentation và maintenance