workman nginx 的proxy_pass

jenchih

问题描述

workman 如何将请求处理,然后做到类似 nginx 的proxy_pass 一样,转发到其他端口

业务场景为我这边nginx转发到php,然后我要根据url进行作负载均衡一样,转发到不同端口

65 1 0
1个回答

timeless-zyg
  location ^~ /api {
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      if (!-f $request_filename){
          proxy_pass http://127.0.0.1:8787;
      }
  }
    location ^~ /admin {
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      if (!-f $request_filename){
          proxy_pass http://127.0.0.1:8888;
      }
  }
×
🔝