Ubuntu 源碼安裝Kong

安裝openresty

1.下載openssl-1.0.2h

tar xzvf openssl-1.0.2h.tar.gz

2.下載openresty

官方安裝指引:https://openresty.org/cn/installation.html

以下是我個人安裝流程

tar xzvf openresty-1.9.15.1.tar.gz

安裝openresty前需要先 準備對應(yīng)的庫有: perl 5.6.1+, libreadline, libpcre, libssl

如果為ubuntu用戶則

apt-get install libreadline-dev libncurses5-dev libpcre3-dev \
    libssl-dev perl make build-essential

下載完畢后進入目錄

./configure  \
--prefix=/opt/openresty \
--with-openssl=../openssl-1.0.2h \
--with-pcre-jit   \
--with-ipv6   \
--with-http_realip_module   \
--with-http_ssl_module   \
--with-http_stub_status_module

其中 --prefix=/opt/openresty 為安裝目錄

make
make install
$ export PATH="/opt/openresty/bin:/opt/openresty/nginx/sbin:$PATH"
nginx -v

nginx version: openresty/1.9.15.1

表示成功安裝

安裝luarocks

luarocks為lua的包管理工具

1.克隆源碼

git clone https://github.com/keplerproject/luarocks.git

2.配置、編譯、安裝

./configure \
  --lua-suffix=jit \
  --with-lua=/opt/openresty/luajit \
  --with-lua-include=/opt/openresty/luajit/include/luajit-2.1

make

make install

安裝serf v0.7

下載地址 https://www.serf.io/downloads.html

解壓后移到 /usr/local/bin 或者 /usr/bin 目錄下

安裝 Kong

1.克隆源碼并安裝

$ git clone https://github.com/Mashape/kong
$ git checkout next
$ luarocks make
$ cd bin
$ sudo cp kong /usr/local/bin

2.修改配置文件

在源碼的根目錄下有個 kong.conf.default 文件,修改里面對應(yīng)的配置使其滿足你的需要。

運行 Kong

KONG_DATABASE=postgres kong start -c /etc/kong/kong.conf
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容