4

Running Jenkins standalone (The WAR file, java -war ./jenkins.war or whatever the command is) listening on a non-standard port. I want to get NGINX to proxy from our HTTPS site /jenkins/ to this standalone.

location /jenkins/ {
    proxy_pass http://axolotl.ecogeek.local:10112/;
}

Problem is, Jenkins still things it's at the root URL so all requests are relative to that, so when accessing /jenkins/ it redirects to /login but it needs to go to /jenkins/login, is there any way, through Jenkins or through NGINX, to change the root URL and get it to play nice?

edit

Connecting to Jenkins on it's normal port I can go to Manage Jenkins->Configure System->Jenkins URL and change that, that fixes the redirection but all the media is being requested from /static/ (Have tried restarting Jenkins)

2 Answers2

2

When you go into the Jenkins control panel, you will see a "Manage Jenkins" link. Somewhere down that page, you'll see "Jenkins URL". Try setting that to example.com/jenkins or whatever scheme you have.

Take a look at:

https://wiki.jenkins-ci.org/display/JENKINS/Running+Hudson+behind+Nginx

So, Jenkins is apparently stupid about some things, and you'll need rewrites.

cjc
  • 24,916
  • 3
  • 51
  • 70
0

Try making a 301 redirect from / to /jenkins/ (be sure to carry the request data over).

ionFish
  • 315
  • 2
  • 11
  • There is other stuff at / I can't remove –  Mar 10 '12 at 15:09
  • Your solution will fail if the OP wants to have other stuff in / – cjc Mar 10 '12 at 15:11
  • Yes, true. Jenkins is a pain to get working through proxies, because it is written in a way that takes files relatively TO THE DOMAIN but not to the directory. – ionFish Mar 10 '12 at 17:48