1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
   |  ➜  kong git:(master) ✗ cat docker-compose.yaml version: '2' services:   kong:     image: kong:latest     environment:       - KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl       - KONG_DATABASE=off       - KONG_DECLARATIVE_CONFIG=/usr/local/kong/declarative/kong.yml       - KONG_PROXY_ACCESS_LOG=/dev/stdout json       - KONG_ADMIN_ACCESS_LOG=/dev/stdout       - KONG_PROXY_ERROR_LOG=/dev/stderr       - KONG_ADMIN_ERROR_LOG=/dev/stderr     volumes:       - ./kong.yaml:/usr/local/kong/declarative/kong.yml       - ./nginx-template:/etc/kong/nginx-template.conf     ports:       - 8000:8000       - 8001:8001       - 8443:8443       - 8444:8444       - 8881:8881     command: ["kong", "docker-start", "--nginx-conf", "/etc/kong/nginx-template.conf"]
 
  ➜  kong git:(master) ✗ cat nginx-template worker_processes ${{NGINX_WORKER_PROCESSES}}; daemon ${{NGINX_DAEMON}};
  pid pids/nginx.pid;
 
 
  error_log logs/error.log ${{LOG_LEVEL}};
  events {     use epoll;     multi_accept on; }
  http {     log_format json '{ "timestamp": "$time_local", '                         '"server_name": "$host",'                         '"remote_addr": "$remote_addr", '                         '"ip": "$http_ip", '                         '"remote_user": "$remote_user", '                         '"body_bytes_sent": "$body_bytes_sent", '                         '"request_time": "$request_time", '                         '"status": "$status", '                         '"request": "$request", '                         '"request_method": "$request_method", '                         '"http_referrer": "$http_referer", '                         '"body_bytes_sent":"$body_bytes_sent", '                         '"http_x_forwarded_for": "$http_x_forwarded_for", '                         '"http_user_agent": "$http_user_agent" }';
      include "nginx-kong.conf";
      server {         listen 8881;         location / {             return 200 "1";         }     } }
 
 
  ➜  kong git:(master) ✗ cat kong.yaml _format_version: "1.1"
  services: - name: xiemx.com-service   retries: 3   connect_timeout: 60000   read_timeout: 60000   write_timeout: 60000      host: xiemx.com-upstream      protocol: https
  - name: TCPService   url: http://ifconfig.io
  - name: mockbin.org-service   url: http://mockbin.org
  routes: - name: HTTPRoute   service: xiemx.com-service      hosts: ["xiemx.com"]   methods: ["GET", "POST", "HEAD"]      headers: { "version": ["v1","v2"]}   paths:     - /v1/\d+     - /v2/\d+/status/\d+     - /v3     - /v4/any/     - /   regex_priority: 6
  - name: mockbin.org-route   service: mockbin.org-service   hosts: ["mockbin.org"]
  - name: TCPRoute   service: TCPService   protocols:     - tls     - tcp   sources:     - { ip: 1.1.1.1/32, port: 1234 }     - ip: 127.0.0.0/8   destinations:     - { ip: 2.2.2.2/32, port: 1234 }     - ip: 10.0.0.0/8
 
 
  plugins: - name: key-auth   service: mockbin.org-service   consumer: xiemx1
  consumers: - username: xiemx1   keyauth-credentials:   - key: 1
  - username: xiemx2   keyauth-credentials:   - key: 2
  upstreams:
 
 
 
  - name: xiemx.com-upstream   targets:     - target: www.xiemx.com:443   algorithm: "round-robin"      hash_on: "none"   hash_fallback: "none"   hash_on_cookie_path: "/"   slots: 10001   healthchecks:     active:         https_verify_certificate: true         unhealthy:             http_statuses: [429, 404, 500, 501, 502, 503, 504, 505]             tcp_failures: 0             timeouts: 0             http_failures: 0             interval: 0         http_path: "/"         timeout: 1         healthy:             http_statuses: [200, 302]             interval: 0             successes: 0                  concurrency: 10         type: "http"     passive:         unhealthy:             http_failures: 0             http_statuses: [429, 500, 503]             tcp_failures: 0             timeouts: 0         type: http         healthy:             successes: 0             http_statuses: [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308]   tags:     - http     - xiemx
 
  |