APISIX Quick Start

安裝依賴:

# install epel, `luarocks` need it.
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm

# add OpenResty source
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

# install OpenResty, etcd and some compilation tools
sudo yum install -y etcd openresty curl git gcc luarocks lua-devel

# start etcd server
sudo service etcd start

安裝 apisix:

sudo yum install -y https://github.com/apache/incubator-apisix/releases/download/1.3/apisix-1.3-0.el7.noarch.rpm

啟動 apisix:

sudo apisix start

檢查是否正常運(yùn)行:

ps aux|grep apisix
netstat -lntp | grep 9080

可選:修改 /user/local/apisix/conf/config.yaml 的 apisix.admin_key:

apisix:
  # ... ...
  admin_key
    -
      name: "admin"
      key: abcdefghabcdefgh
      role: admin
curl http://127.0.0.1:9080/apisix/admin/routes?api_key=abcdefghabcdefgh -i
HTTP/1.1 200 OK
Date: Fri, 28 Feb 2020 07:48:04 GMT
Content-Type: text/plain
... ...
{"node":{...},"action":"get"}

也可以不更改,直接使用默認(rèn)的 api_key:

curl http://127.0.0.1:9080/apisix/admin/routes?api_key=edd1c9f034335f136f87ad84b625c8f1 -i

訪問 APISIX Dashboard(http://localhost:9080/apisix/dashboard)。

注意:如果訪問 Dashboard 出現(xiàn) 403,需要修改 /user/local/apisix/conf/config.yaml 中的 allow_admin 字段,增加訪問機(jī)器的 IP 地址,如果不知道 IP 地址,可以查看 /usr/local/apisix/logs/error.log 日志,該日志會記錄訪問機(jī)器的 IP 地址。

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

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