Nginx+Lua 开源网关Apisix尝鲜

[[doc]]

下载

 wget https://github.com/etcd-io/etcd/releases/download/v3.5.1/etcd-v3.5.1-linux-amd64.tar.gz
 tar -zxf etcd-v3.5.1-linux-amd64.tar.gz 
 cd etcd-v3.5.1-linux-amd64/
 cp etcd /usr/local/bin/
 cp etcdctl /usr/local/bin/
 mkdir -p /var/lib/etcd
 mkdir -p /etc/etcd

编辑 vim /usr/lib/systemd/system/etcd.service

[Unit]

Description=Etcd Server

After=network.target

 

[Service]

User=root

Type=simple

WorkingDirectory=/var/lib/etcd/

EnvironmentFile=-/etc/etcd/etcd.conf

ExecStart=/usr/local/bin/etcd

 

[Install]

WantedBy=multi-user.target

编辑配置文件 vim /etc/etcd/etcd.conf

#[member]

ETCD_NAME=default

ETCD_DATA_DIR="/var/lib/etcd/default.etcd"

ETCD_LISTEN_CLIENT_URLS="http://127.0.0.1:2379"

ETCD_ADVERTISE_CLIENT_URLS="http://127.0.0.1:2379"

启动

systemctl daemon-reload
systemctl enable etcd.service
systemctl start etcd.service

# 安装apisix

wget https://github.com/apache/apisix/releases/download/2.10.2/apisix-2.10.2-0.el7.x86_64.rpm
rpm -ivh apisix-2.10.2-0.el7.x86_64.rpm 
apisix start

# 启动报错如下

nginx: [emerg] unknown directive "real_ip_header" in /usr/local/apisix/conf/nginx.conf:114

这是因为编译的openresty的时候,没有指定--with-http_realip_module,重新编译安装:

未完。。。测试中