如何在nginx中重定向多个url?

时间:2016-01-29 16:55:49

标签: nginx

我需要支持nginx配置,特别是对于位置blok。

就像那样:

localhost/issue_x/ -> show as a autoindex /var/lib/jenkins/issue_x/

localhost/issue_x/foobar/*view*/ -> show file foobar as a plain text in webpage from /var/lib/jenkins/issue_x/archive/foobar

1 个答案:

答案 0 :(得分:0)

如果我理解你的愿望:

location /issue_x {
  root /var/lib/jenkins;
  autoindex on;
}

location ~ /issue_x/foobar/.*view.*/ {
  alias /var/lib/jenkins/issue_x/archive/;
  rewrite ^.* /foobar last;
}