First let me note that I've seen this question here before, but never with an answer that actually works.

Here is the issue: I have a Jenkins server running on 8080 (Ubuntu 14.04). I'm trying to port it to [domain]/ci/. While this is fairly simple thing, and it dose work, most of the links are still going to the root, that is [domain], thus rendering the server unapproachable from that address. I have tried all kind of options with

proxy_redirect http://$host/ http://$host/ci/;

With the port or without it, full host name, localhost... you name it. Nothing. Links are still going to the root of the server, so many links, all the images and the scripts are unavailable.

hereby is the ci section in the configuration file. would LOVE some input on that, it just won't work.

 location /ci/ {
            proxy_pass http://localhost:8080/;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_redirect http://$host/ http://$host/ci/;


curl -I [domain]/ci


Location: http://[domain]/ci/

But it doesn't work. This might very well be Jenkins fault, as the links are all following root (e.g <link rel="stylesheet" type="text/css" href="/static/15751a6d/css/style.css" />) , but I still believe that I'm missing something.


The problem of your setup is that Jenkins is unaware that you moved its root url.
As Jenkins wiki says you should use following args to run it correctly:

JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --prefix=/ci"

Recommended reading: Jenkins wiki


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.