Skip to content

Configuration File sample

FijianJacobs edited this page Jan 7, 2020 · 5 revisions

配置示例

{
  "profile": "local", 
  "service_name":"GatewayService",
  "cluster_node_count" : 1, 
  "load_conf_delay" : 0,
  "load_conf_interval" : 5,
  "load_ext_conf_interval" : 60,
  "plugins": [
    "zk_dynamic_upstream"
  ],
  "zookeeper_conf": {
    "servers":["172.25.73.101:2181","172.25.73.102:2181","172.25.73.103:2181"], 
    "timeout":5000
  },
  "application_conf":{
    "service_type":"gateway_service", 
    "hosts":["localhost"],
    "log_level": "error",
    "access_log": "/var/log/orProxy/default.access.log", 
    "error_log":"/var/log/orProxy/default.error.log",
    "worker_processes_count":"auto",
    "event_mode": "kqueue", 
    "worker_rlimit":"65535",
    "worker_connections":"65535",
    "lua_code_cache":"on",
    "lua_socket_pool_size":"20",
    "wk_global_cache_dict_size":"100m",
    "wk_lock_dict_size":"10m",
    "lua_max_pending_timers":"16384",
    "lua_max_running_timers":"4096",
    "hosts_conf": [
      {
        "host": "localhost",
        "log_level":"error",
        "access_log":"/var/log/orProxy/localhost.access.log",
        "error_log":"/var/log/orProxy/localhost.error.log", 
        "non_body":"true",
        "listen_port":80,
        "error_page_switch":"off",
        "open_ssl":"off",
        "ssl_certificate":"",
        "ssl_certificate_key":"",
        "add_headers":[],
        "proxy_intercept_errors":"off",
        "error_page_code":"400 404 408 411 412 413 414 417 500 502 503 504",
        "proxy_next_upstream":"error timeout invalid_header http_503 http_502 http_504 non_idempotent",
        "non_idempotent_retry_switch":"off"
      }
    ]
  }
}

主要配置项说明

zookeeper_conf.servers: zookeeper server地址列表

zookeeper_conf.timeout: zookeeper连接超时时间

application_conf.hosts: virtual host列表

application_conf.access_log: 全局访问日志路径

application_conf.error_log:全局错误日志路径

application_conf.event_mode: Nginx Event model(macox:kqueue, linux:epoll)

application_conf.hosts_conf.host: 指定virtual host name

application_conf.hosts_conf.access_log: 指定virtual host访问日志路径

application_conf.hosts_conf.error_log: 指定virtual host错误日志路径