動態反向代理:Ceryx

jopen 9年前發布 | 20K 次閱讀 Ceryx Web服務器

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

項目主頁:http://www.baiduhome.net/lib/view/home/1438132444316

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!