Kong 的安装和使用
参考链接
Kong 的安装和启动
准备数据库
提供一个 PostgreSQL 连接地址,及一个具备创建表权限的账号密码,进行数据表的初始化操作
1 | docker run --rm \ |
启动 Kong
提供一个 PostgreSQL 连接地址,及一个具备读写数据权限的账号密码启动服务
1 | docker run -d --restart=unless-stopped \ |
验证服务
1 | curl -i -X GET --url http://localhost:8001/services |
使用 KongA 进行管理
KongA 不会直接访问 Kong 的数据库,其数据库可以区别于 KongDB 进行保存,支持 MySQL 或 PostgreSQL (而 KongDB 仅支持 PostgreSQL)
此处我使用 MySQL
初始化数据库
1 | docker run --rm pantsel/konga:latest -c prepare -a mysql -u mysql://${USERNAME}:${PASSWORD}@${HOST}/${DBNAME} |
启动 KongA
1 | docker run -d --restart=unless-stopped \ |
Tips
The general form of a connection URI in PostgreSQL:
1 | postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...] |
Defines trusted IP addresses blocks that are known to send correct X-Forwarded-* headers.
Requests from trusted IPs make Kong forward their X-Forwarded-* headers upstream.
Non-trusted requests make Kong insert its own X-Forwarded-* headers.
This property also sets the set_real_ip_from directive(s) in the Nginx configuration. It accepts the same type of values (CIDR blocks) but as a comma-separated list.
To trust all /!\ IPs, set this value to 0.0.0.0/0,::/0.
If the special value unix: is specified, all UNIX-domain sockets will be trusted.
See http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from for examples of accepted values.
Default: none