Ceryx动态反向代理

联合创作 · 2023-10-01 10:30

Ceryx 是基于 NGINX OpenResty 的动态反向代理,带有一个 API。

代理

Ceryx 使用 NGINX OpenResty 为了基于请求主机进行路由请求。这个路由是使用 NGINX Lua 模块制作的,可以通过查询一个 Redis 后端获取结果。

API

Ceryx 包含一个简单 Flask Web 服务,支持路由的 REST 操作。用户可以使用一个 REST 客户端动态创建,更新和删除路由。

配置

Ceryx 支持使用环境变量配置,支持的配置选项:

  • CERYX_NAME: sets the API service name - defaults to ceryx

  • CERYX_DEBUG: enables debuging on the API service - defaults to true

  • CERYX_API_HOST: sets the host that the API will bind to - defaults to 127.0.0.1

  • CERYX_API_PORT: sets the port that the API will listen - defaults to 5555

  • CERYX_SERVER_NAME: the URL of the API service - default to None

  • CERYX_SECRET_KEY: the path of the secret key to use - defaults to None

  • CERYX_REDIS_HOST: the redis host to connect to - defaults to 127.0.0.1

  • CERYX_REDIS_PORT: the redis port to connect to - defaults to 6379

  • CERYX_REDIS_PREFIX: the redis prefix to use in keys - defaults to ceryx

示例:

# production.yml
proxy:
  extends:
    file: base.yml
    service: proxy
  ports:
   - "80:80"
  environment:
   - CERYX_REDIS_HOST=my.redis.host
api:
  extends:
    file: base.yml
    service: api
  ports:
   - "5555:5555"
  environment:
   - CERYX_REDIS_HOST=my.redis.host
   - CERYX_DEBUG=false
   - CERYX_SECRET_KEY=/path/to/production/secret
浏览 8
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报