{
 "LEMP 架構與 PHP-FPM#1": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   2,
   2
  ],
  "cards": [
   {
    "title": "LAMP",
    "points": [
     "Linux",
     "Apache",
     "MariaDB 或 MySQL",
     "PHP"
    ]
   },
   {
    "title": "LEMP",
    "points": [
     "Linux",
     "Nginx(讀作 E)",
     "MariaDB",
     "PHP"
    ]
   }
  ]
 },
 "LEMP 架構與 PHP-FPM#2": {
  "type": "flow",
  "reveal": [
   0,
   2,
   4
  ],
  "nodes": [
   {
    "label": "瀏覽器",
    "color": 0
   },
   {
    "label": "Nginx",
    "color": 1,
    "sub": "靜態檔直接回"
   },
   {
    "label": "PHP-FPM",
    "color": 2,
    "sub": "執行 .php"
   },
   {
    "label": "MariaDB",
    "color": 3,
    "sub": "需要資料時"
   }
  ]
 },
 "LEMP 架構與 PHP-FPM#3": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   2
  ],
  "head": [
   "Ubuntu",
   "預設 PHP",
   "服務名稱"
  ],
  "rows": [
   [
    "22.04",
    "8.1",
    "php8.1-fpm"
   ],
   [
    "24.04",
    "8.3",
    "php8.3-fpm"
   ]
  ],
  "widths": [
   2,
   2,
   3
  ]
 },
 "LEMP 架構與 PHP-FPM#4": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   3
  ],
  "head": [
   "步驟",
   "指令"
  ],
  "rows": [
   [
    "更新清單",
    "sudo apt update"
   ],
   [
    "安裝",
    "sudo apt install php-fpm php-mysql php-mbstring php-xml php-curl php-zip php-gd"
   ],
   [
    "看版本",
    "php -v"
   ]
  ],
  "widths": [
   2,
   6
  ]
 },
 "LEMP 架構與 PHP-FPM#5": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   3
  ],
  "nodes": [
   {
    "label": "ls /run/php/",
    "color": 0,
    "sub": "列出目錄"
   },
   {
    "label": "php8.3-fpm.sock",
    "color": 1,
    "sub": "Nginx 靠它溝通"
   },
   {
    "label": "systemctl status",
    "color": 2,
    "sub": "php8.3-fpm"
   }
  ]
 },
 "LEMP 架構與 PHP-FPM#6": {
  "type": "table",
  "reveal": [
   0,
   1,
   2
  ],
  "head": [
   "設定",
   "內容"
  ],
  "rows": [
   [
    "include",
    "snippets/fastcgi-php.conf"
   ],
   [
    "fastcgi_pass",
    "unix:/run/php/php8.3-fpm.sock"
   ]
  ],
  "widths": [
   2,
   4
  ]
 },
 "安裝與保護 MariaDB 資料庫#3": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ],
  "head": [
   "步驟",
   "指令"
  ],
  "rows": [
   [
    "安裝",
    "sudo apt install mariadb-server"
   ],
   [
    "看服務",
    "sudo systemctl status mariadb"
   ],
   [
    "安全設定",
    "sudo mysql_secure_installation"
   ],
   [
    "登入",
    "sudo mariadb"
   ],
   [
    "查版本",
    "SELECT VERSION();"
   ]
  ],
  "widths": [
   2,
   5
  ]
 },
 "安裝與保護 MariaDB 資料庫#4": {
  "type": "cards",
  "reveal": [
   1,
   2,
   3,
   4,
   4
  ],
  "cards": [
   {
    "title": "最小權限",
    "points": [
     "一個應用",
     "一個資料庫",
     "一個帳號"
    ]
   },
   {
    "title": "字元集",
    "points": [
     "用 utf8mb4",
     "支援中文與表情"
    ]
   },
   {
    "title": "@localhost",
    "points": [
     "只允許本機連入"
    ]
   },
   {
    "title": "強密碼",
    "points": [
     "密碼管理器產生",
     "20 字元以上"
    ],
    "value": "20+ 字元"
   }
  ]
 },
 "安裝與保護 MariaDB 資料庫#5": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3
  ],
  "head": [
   "SQL",
   "作用"
  ],
  "rows": [
   [
    "CREATE DATABASE appdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;",
    "建立資料庫"
   ],
   [
    "CREATE USER 'appuser'@'localhost' IDENTIFIED BY '...';",
    "建立帳號"
   ],
   [
    "GRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'localhost';",
    "只授權 appdb"
   ]
  ],
  "widths": [
   6,
   2
  ]
 },
 "安裝與保護 MariaDB 資料庫#7": {
  "type": "table",
  "reveal": [
   0,
   0,
   2,
   2
  ],
  "head": [
   "ss 看到",
   "意義"
  ],
  "rows": [
   [
    "127.0.0.1:3306",
    "只聽本機,正確"
   ],
   [
    "0.0.0.0:3306",
    "全網路開放,檢查 bind-address"
   ]
  ],
  "widths": [
   2,
   3
  ]
 },
 "串接 PHP 與資料庫、調校與安全設定#5": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   3,
   3
  ],
  "cards": [
   {
    "title": "放在根目錄外",
    "points": [
     "設定檔與 .env",
     "不被當靜態檔送出"
    ]
   },
   {
    "title": "權限只給網站",
    "points": [
     "chown deploy:www-data",
     "chmod 640"
    ],
    "value": "640"
   },
   {
    "title": "不進公開 Git",
    "points": [
     "含密碼的檔案",
     "勿提交"
    ]
   }
  ]
 },
 "串接 PHP 與資料庫、調校與安全設定#7": {
  "type": "bar",
  "reveal": [
   0,
   0,
   0,
   0,
   0,
   1,
   2
  ],
  "labels": [
   "最多行程",
   "啟動行程"
  ],
  "values": [
   10,
   3
  ],
  "unit": "個"
 }
}