candy 发表于 2018-11-10 10:06:49

nginx-locaiton

  nginx重定向写出了死循环:
  正确的写法如下:
  if ($host ~ wt\.abc\.cn) {
  rewrite ^/$ http://wt.abc.cn/static/mail/register.html last;
  rewrite ^/\?from\=(+) http://wt.abc.cn/sc/mb/rr.html?from=$1 last;
  }
  ===========rewrite+proxy_pass
  location ~ ^/static {
  rewrite ^/static/html/(.*)$ /html/$1 break;
  proxy_pass http://f1;
  proxy_set_header    Host    $host;
  proxy_set_header    X-Real-IP       $remote_addr;
  proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
  }
  ===========proxy_pass
  location ~ ^/$ {
  if ($host ~* (.*)\.(youyuan.com)) {
  set $host_without_youyuan $1;
  proxy_pass http://nexts/v20/seo_index.html?pt=$host_without_youyuan;
  }
  }
  =========?问题:
  业务想屏蔽http://aaa.com/afa.apk?gajla=1414类似这种链接的访问,只允许访问http://aaa.com/afa.apk   通过location设置
  location ~ .*(?!\.apk$) {
  return 444;
  }
  这种方法是不成功的,因为location是匹配uri,而非参数。
  如果匹配到整个uri则配置如下:
  if ($request_uri ~ '.*\.apk\?.*') {
  return 444;
  }

页: [1]
查看完整版本: nginx-locaiton