重写代理上游

我有一台服务器,在localhost:8080上为我提供LuCI服务。 我想通过nginx代理它,但我想重写的URL,而不是https://myserver/cgi-bin/luci ,我有https://myserver/

这是我到目前为止,这似乎并没有工作:

 upstream luci { server localhost:8080; } server { # ... location / { proxy_pass http://luci; proxy_redirect / /cgi-bin/luci; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; } } 

但是,在这个configuration下,我仍然看到我的url前缀为/cgi-bin/luci ,而且他们仍然以某种方式工作。

我如何重写我的传入请求从https://myserver/^(.*)$http://luci/cgi-bin/luci$1