Site logo

Triển khai LEMP Stack với Ansible: Hướng dẫn deploy NGINX + PHP-FPM + MySQL từ A-Z

5:00 read

🚀 Triển khai NGINX + PHP-FPM + MySQL bằng Ansible

Series: Ansible từ Zero đến Hero – Thực chiến Deploy Web Stack

Trong bài này, chúng ta sẽ triển khai một stack web phổ biến trên Linux server:

NGINX – Web server ✔ PHP-FPM – Xử lý PHP ✔ MySQL – Database

Bằng Ansible, chúng ta có thể tự động hóa toàn bộ quá trình.


🎯 Mục tiêu bài học

Sau bài này, bạn sẽ biết cách:

🔧 Cài đặt NGINX, PHP-FPM, MySQL bằng Ansible 📁 Cấu hình Virtual Host NGINX từ template Jinja2 💾 Tạo database và user trong MySQL ♻️ Restart service bằng Handlers 🏗 Viết một playbook triển khai hoàn chỉnh


🧱 Chuẩn bị

Inventory (hosts):

[web]
192.168.1.10

[db]
192.168.1.11

Thư mục playbook:

deploy-lamp/
 ├─ site.yml
 ├─ templates/
 │   └─ nginx.conf.j2
 └─ group_vars/
    ├─ web.yml
    └─ db.yml

Yêu cầu đăng nhập

Vui lòng đăng nhập để truy cập nội dung này

Additional Resources

Course Guide

Comprehensive PDF guide with examples

GitHub Repository

Example code for all lessons

Discussion

Have a question about this lesson? Post it here and get answers from instructors and peers.