Nginx 定位,重写,upstream 和 proxy_pass 问题,无法访问 URL

时间:2021-07-14 16:30:43

标签: nginx nginx-reverse-proxy nginx-config nginx-location upstream

我想通过 nginx 访问这个 url -> 201.12.12.12:8080/mystring

以下是我的配置:

location ^/develop/api/ {
  rewrite ^/develop/api/(.*) /$1  break;
  proxy_pass http://api/$uri$is_args$args;
}

upstream api {
      least_conn;
      keepalive 32;
      zone upstream-counting 64k;
      server 201.12.12.12:8080 max_fails=3 fail_timeout=60 weight=1;
}

为此,我尝试使用 201.12.12.12/develop/api/mystring 通过上游“api”将其指向 201.12.12.12:8080/mystring但我无法访问它并收到“无法访问此站点”

  1. 我想知道我哪里出错了?
  2. $uri$is_args$args 有什么用;在 proxy_pass 中?
  3. 是否需要重写?

0 个答案:

没有答案