0
Answered

Reverse Proxy to other subdir behind nginx

Frank Kubis 9 years ago updated by Eugene Pankov (Project coordinator) 9 years ago 2
Hi,

iIs it possible to run ajenti in other subdir as /ajenti using reverse proxy with nginx?
I would like to run it under /web1, because I would like to set up a second server with ajenti and the same domain. But I got only one valid certificate, so need to change the name.

Using latest nginx, I tried:

location /web1 {
rewrite (/web1)$ / break;
rewrite /web1/(.*) /$1 break;
rewrite ^/(.*)/$ /web1/;
proxy_pass http://127.0.0.1:8000;
proxy_redirect / /web1/;
proxy_set_header Host $host;
proxy_set_header Origin http://$host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
}

But it uses still /ajenti:, it should be /web1/ajenti:.

Answer

Answer
Answered
This isn't possible, because Ajenti pages include absolute /ajenti:.* URLs.
BAD, I'M UNSATISFIED
Mhm thats bad, any idea how to resolve my problem?
Satisfaction mark by Frank Kubis 9 years ago
Answer
Answered
This isn't possible, because Ajenti pages include absolute /ajenti:.* URLs.
I think it might be possible to proxy to different hosts based on port - e.g., host:443/ajenti/ and host:444/ajenti/ with the same certificate