Mac下源码构建Kong

2018-02-15  本文已影响0人  疯狂的橙

背景

参考资料:
Nginx中文
Openresty中文
Kong的Github

构建说明

版本:
Openresty : 1.13.6.2rc0
Kong: 0.12.1

brew update
brew install openssl  pcre        
# 如果存在则可以更新
brew upgrade openssl pcre
git clone https://github.com/openresty/openresty.git
cd openresty
make 
生成openresty代码

cd openresty-1.13.6.2rc0

源码包
./configure \
  --with-pcre-jit \
  --with-ipv6 \
  --with-http_realip_module \
  --with-http_ssl_module \
  --with-http_stub_status_module \
  --with-http_v2_module \
  --with-cc-opt="-I/usr/local/opt/openssl/include/ -I/usr/local/opt/pcre/include/" \
  --with-ld-opt="-L/usr/local/opt/openssl/lib/ -L/usr/local/opt/pcre/lib/" \
  -j4

这里的openssl和pcre的头文件和库文件都安装在/usr/local/opt下,如果使用brew安装的,默认是该路径,如果不在则需要修改,否则编译Nginx会出错

make
sudo make install

将openresty加入环境变量,默认安装在/usr/local/openresty

echo export PATH=$PATH:/usr/local/openresty >> ~/.zshrc
source ~/.zshrc

openresty安装参考:
http://openresty.org/cn/installation.html

git clone https://github.com/Kong/kong.git
cd kong
sudo make install

官方安装向导切换到next分支git checkout next,本文直接在master分支

进入容器,创建用户及库

su - postgres
psql
CREATE USER kong; CREATE DATABASE kong OWNER kong;
容器shell
sudo kong start
版本验证失败

修改Kong使用的Openresty版本

cd /usr/local/share/lua/5.1/kong
vi meta.lua

openresty最新版本是openresty/1.13.6.2rc0 (clone日:2018-02-15)
修改kong脚本中的版本(也可以在下载的源码中修改后安装)


修改必要版本信息.png
kong start

请参考kong配置说明
https://getkong.org/docs/0.12.x/getting-started/adding-your-api/

后记

上一篇 下一篇

猜你喜欢

热点阅读