Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks, just found that (see edit) but the static stuff is still coming from /static/ =( –  sam Mar 10 '12 at 15:17
    
@sam See update –  cjc Mar 10 '12 at 15:24
add comment

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

share|improve this answer
    
There is other stuff at / I can't remove –  sam 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
add comment

Your Answer

 
discard

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

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