I’d like to proxy Jenkins using nginx. I already have a working version of this using this configuration file in /etc/sites-available/jenkins:
server {
listen 80;
listen [::]:80 default ipv6only=on;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8080;
}
}
However, what I’d like to do is host Jenkins at a relative url, like /jenkins/. However, when I change my location directive to point at /jenkins/, it breaks everything. How can I make this (hopefully simple) change?
the problem lies in
you’re not setting a uri in this proxy_pass which according to http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass means:
in other words it’s passing on the /jenkins to your app
I think adding a slash to the proxy_pass should work, as follows:
as that would be a request with a uri which according to the link above means:
If adding the slash does not work, you’ll have to change it at the other end by configuring jenkins to expect the /jenkins/ url’s