-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Home
YuanSheng Wang edited this page Jun 3, 2019
·
6 revisions
# add OpenResty source
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
# install OpenResty and compile tools
sudo yum install git automake autoconf gcc pcre-devel libtool gcc+ gcc-c++ \
luarocks etcd openresty -y
# start etcd server
sudo service etcd start
# install apisix server
luarocks install apisix
# init etcd
curl http://127.0.0.1:2379/v2/keys/apisix/routes -X PUT -d dir=true
curl http://127.0.0.1:2379/v2/keys/apisix/upstreams -X PUT -d dir=true
curl http://127.0.0.1:2379/v2/keys/apisix/services -X PUT -d dir=true
# add new route
curl http://127.0.0.1:2379/v2/keys/apisix/routes/1 -X PUT -d value='
{
"methods": ["GET"],
"uri": "/index.html",
"id": 1,
"plugin_config": {
"limit-count": {
"count": 2,
"time_window": 60,
"rejected_code": 503,
"key": "remote_addr"
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"39.97.63.215:80": 1
}
}
}'
# start apisix server
sudo apisix init
sudo apisix start
# make a test
$ curl -i http://127.0.0.1:9080/index.html