MacOS下安装OpenResty 踩坑记录

OpenResty

OpenResty是基于 Nginx 的一个“强化包”,除了包含 Nginx 的功能模块,它的功能更加丰富,集成了脚本语言 Lua 简化 Nginx 二次开发,能更方便快速地搭建动态网关。

本文不涉及OpenResty知识点,简单记录下在搭建OpenResty的过程中遇到一些坑,希望能帮助需要的朋友。

主要两个简单的命令

brew tap openresty/brew //  添加仓库
brew install openresty  //  安装

问题一:连不上raw.githubusercontent.com port 443

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused Error: Failed to download resource "openresty-openssl--patch" Download failed: https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-1.1.0d-sess\_set\_get\_cb\_yield.patch

原因:域名被DNS污染了,需要重新设置一下本地hosts,域名解析的读取顺序是:浏览器缓存->本地hosts文件->外部DNS

解决:在本地hosts文件加上:199.232.4.133 raw.githubusercontent.com

问题二:安装xcode-select

image.png

这个比较简单,直接按提示安装即可。

问题三:找不到GeoIP包

checking for SA\_RESTART ... found + ngx\_stream\_lua\_module was configured 
checking for PCRE library ... found 
checking for PCRE JIT support ... found 
checking for OpenSSL library ... found 
checking for zlib library ... found 
checking for GeoIP library ... not found 
checking for GeoIP library in /usr/local/ ... not found checking for GeoIP library in /usr/pkg/ ... not found checking for GeoIP library in /opt/local/ ... not found

解决:安装geoip

brew install geoip

继续报错:

Warning: geoip 1.6.12 is already installed, it's just not linked
You can use `brew link geoip` to link this version.

按提示走

brew link geoip

继续报错:

Linking /usr/local/Cellar/geoip/1.6.12... 
Error: Could not symlink include/GeoIP.h
/usr/local/include is not writable.

这里涉及了一些写入的权限问题。解决办法主要是修改文件权限为当前用户。若路径下没有include文件夹还需要创建一下。

解决:

cd /usr/local
sudo mkdir include
sudo chown -R $(whoami) $(brew --prefix)/include

继续命令,即成功!

brew link geoip
brew install openresty

你可能感兴趣的:(macos,openresty)