搭建 http 环境
OpenResty
OpenResty 基于 Nginx 的 “强化包”,不仅支持 http/https,还特别集成了脚本语言 Lua 简化 Nginx 二次开发。方便搭建动态网关,能够当成应用容器来编写业务逻辑
wireshark
wireshark 抓包工具,能够截获在 TCP/IP 协议栈中传输的所有流量,并按协议类型、地址、端口等任意过滤。
项目运行
1 | $ cd http_study/www/ |
mac 使用 run.sh 替换 windows 的 run.bat
127.0.0.1 为 loopback 环回地址 wireshark(windows) 中选择 Npcap loopback Adapter; wireshark(mac) 选择 loopback: lo0
踩坑记
Error: Failed to connect to raw.githubusercontent.com port 443:Failed to download resource “openresty-openssl111–patch”
域名被 DNS 污染了,需要重新设置下本地的 hosts 域名解析顺序:浏览器缓存 -> 本地 hosts -> 外部 DNS
1 | $ vim /etc/hosts |
Error: An unexpected error occurred during the brew link
step 解决办法
1 | # 创建 Frameworks 文件夹 |
The capture session could not be initiated on interface ‘lo0’ (You don’t have …
打开终端输入命令sudo chmod 777 /dev/bpf*