Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a server which serves LuCI for me on localhost:8080. I'm trying to proxy to it via nginx, but I'd like to rewrite the URLs so that instead of https://myserver/cgi-bin/luci, I have https://myserver/.

Here's what I've got so far, which doesn't seem to be working:

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;

However, with this configuration, I'm still seeing my urls prefixed with /cgi-bin/luci, and they still work somehow.

How can I rewrite my incoming requests from https://myserver/^(.*)$ to http://luci/cgi-bin/luci$1?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.