{
 "網頁伺服器如何運作與安裝 Nginx#1": {
  "type": "flow",
  "reveal": [
   0,
   3,
   4,
   5
  ],
  "nodes": [
   {
    "label": "輸入網址",
    "color": 0
   },
   {
    "label": "DNS 找 IP",
    "color": 1
   },
   {
    "label": "送出請求",
    "color": 2,
    "sub": "80 / 443 埠"
   },
   {
    "label": "找檔或轉後端",
    "color": 3,
    "sub": "靜態 / 動態"
   },
   {
    "label": "回傳內容",
    "color": 4,
    "sub": "含狀態碼"
   }
  ]
 },
 "網頁伺服器如何運作與安裝 Nginx#2": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   2
  ],
  "cards": [
   {
    "title": "Nginx",
    "points": [
     "事件驅動",
     "省記憶體",
     "反向代理、負載平衡",
     "語法簡潔"
    ]
   },
   {
    "title": "Apache",
    "points": [
     "歷史悠久",
     "模組豐富",
     "支援 .htaccess"
    ]
   }
  ]
 },
 "網頁伺服器如何運作與安裝 Nginx#4": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5,
   6
  ],
  "head": [
   "步驟",
   "指令"
  ],
  "rows": [
   [
    "更新清單",
    "sudo apt update"
   ],
   [
    "安裝",
    "sudo apt install nginx"
   ],
   [
    "看服務",
    "sudo systemctl status nginx"
   ],
   [
    "放行防火牆",
    "sudo ufw allow 'Nginx Full'"
   ],
   [
    "看回應標頭",
    "curl -I http://127.0.0.1"
   ],
   [
    "成功",
    "HTTP/1.1 200 OK"
   ]
  ],
  "widths": [
   2,
   5
  ]
 },
 "網頁伺服器如何運作與安裝 Nginx#7": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   4
  ],
  "head": [
   "路徑",
   "用途"
  ],
  "rows": [
   [
    "nginx.conf",
    "主設定檔"
   ],
   [
    "sites-available/",
    "可用的網站設定"
   ],
   [
    "sites-enabled/",
    "已啟用(符號連結)"
   ],
   [
    "conf.d/*.conf",
    "RHEL 系主要用"
   ]
  ],
  "widths": [
   3,
   4
  ]
 },
 "Nginx server block 與虛擬主機#1": {
  "type": "flow",
  "reveal": [
   0,
   1,
   4
  ],
  "nodes": [
   {
    "label": "HTTP 請求",
    "color": 0
   },
   {
    "label": "Host 標頭",
    "color": 1,
    "sub": "寫著網域"
   },
   {
    "label": "比對 server_name",
    "color": 2
   },
   {
    "label": "對應的網站",
    "color": 3,
    "sub": "server block"
   }
  ]
 },
 "Nginx server block 與虛擬主機#2": {
  "type": "bar",
  "reveal": [
   0,
   2,
   2,
   2,
   2
  ],
  "labels": [
   "檔案",
   "目錄"
  ],
  "values": [
   644,
   755
  ],
  "unit": ""
 },
 "Nginx server block 與虛擬主機#3": {
  "type": "table",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "head": [
   "指令",
   "意思"
  ],
  "rows": [
   [
    "listen 80;",
    "監聽 80 埠"
   ],
   [
    "server_name",
    "負責的網域名稱"
   ],
   [
    "root",
    "網站根目錄"
   ],
   [
    "try_files $uri $uri/ =404;",
    "依序試,找不到回 404"
   ]
  ],
  "widths": [
   3,
   4
  ]
 },
 "Nginx server block 與虛擬主機#7": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   4
  ],
  "nodes": [
   {
    "label": "ln -s",
    "color": 0,
    "sub": "啟用網站"
   },
   {
    "label": "rm default",
    "color": 1,
    "sub": "移除預設站"
   },
   {
    "label": "nginx -t",
    "color": 2,
    "sub": "測試設定"
   },
   {
    "label": "reload",
    "color": 3,
    "sub": "新網站上線"
   }
  ]
 },
 "Apache 虛擬主機與日誌分析#3": {
  "type": "table",
  "reveal": [
   0,
   1,
   3,
   4
  ],
  "head": [
   "位置",
   "用途"
  ],
  "rows": [
   [
    "sites-enabled/",
    "已啟用的網站(連結)"
   ],
   [
    "mods-available/",
    "可用的模組"
   ],
   [
    "mods-enabled/",
    "已啟用的模組"
   ],
   [
    "/var/log/apache2/",
    "存取與錯誤紀錄"
   ]
  ],
  "widths": [
   3,
   4
  ]
 },
 "Apache 虛擬主機與日誌分析#4": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3
  ],
  "cards": [
   {
    "title": "Options -Indexes",
    "points": [
     "無 index 檔時",
     "不列出檔案清單"
    ]
   },
   {
    "title": "AllowOverride All",
    "points": [
     "允許 .htaccess",
     "用不到設 None"
    ]
   },
   {
    "title": "Require all granted",
    "points": [
     "Apache 2.4 寫法",
     "Order allow deny 已過時"
    ]
   }
  ]
 },
 "Apache 虛擬主機與日誌分析#6": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "nodes": [
   {
    "label": "a2enmod rewrite",
    "color": 0,
    "sub": "啟用網址重寫"
   },
   {
    "label": "configtest",
    "color": 1,
    "sub": "apache2ctl"
   },
   {
    "label": "Syntax OK",
    "color": 2,
    "sub": "語法沒問題"
   },
   {
    "label": "reload",
    "color": 3,
    "sub": "systemctl reload"
   }
  ]
 },
 "Apache 虛擬主機與日誌分析#7": {
  "type": "table",
  "reveal": [
   0,
   0,
   0,
   4,
   4
  ],
  "head": [
   "指令",
   "用途"
  ],
  "rows": [
   [
    "tail -f access.log",
    "即時觀看"
   ],
   [
    "cut -d' ' -f1 | sort | uniq -c",
    "請求最多的來源 IP"
   ],
   [
    "grep -c ' 404 ' access.log",
    "404 次數"
   ],
   [
    "grep ' 500 ' access.log",
    "伺服器錯誤的請求"
   ]
  ],
  "widths": [
   4,
   3
  ]
 }
}