0

I am currently experiencing the problem that Jenkins is not reachable if I start it with a prefix. The prefix is necessary to get Jenkins available under myurl.de/jenkins (instead of myurl.de:8101).

My configuration file for apache2 /etc/apache2/sites-available/000-default.conf contains:

    ProxyPass /jenkins http://localhost:8101/ nocanon
    ProxyPassReverse /jenkins http://localhost:8101/
    ProxyRequests     Off 
    AllowEncodedSlashes NoDecode

like described in https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Apache. If I run Jenkins solely with: java -jar jenkins.war --httpPort=8101 everything works fine, except a call to myurl.de/jenkins only creates a defect side, because the context path is wrong and other parts of the side, e.g. images, are loaded from wrong locations (from myurl.de/image.png instead of myurl.de/jenkins/image.png).

So like described in the link above, I've started Jenkins with java -jar jenkins.war --httpPort=8101 --prefix=/jenkins. Unfortunately, it says:

Running from: /home/dgr/jenkins2/jenkins.war
webroot: $user.home/.jenkins
Jan 29, 2016 2:25:50 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Jan 29, 2016 2:25:50 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: jetty-winstone-2.9
Jan 29, 2016 2:25:52 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: NO JSP Support for /jenkins, did not find org.apache.jasper.servlet.JspServlet
Jenkins home directory: /home/dgr/.jenkins found at: $user.home/.jenkins

and only responds with 404 both from :8101 and /jenkins. Is this a known bug? I could not find any other description of this behaviour.

Same happens when running Jenkins from the Docker container and setting JENKINS_OPTS --prefix=/jenkins). I am using latest Jenkins which is 1.646 and also latest Docker image. Different solutions like setting the path in the UI under Configure -> Jenkins URL like suggested in https://stackoverflow.com/questions/9089566/jenkins-website-root-path does not work either.

1 Answer 1

1

The proxy configuration and context path must match.

The proxy configuration example in the document you referenced assumes the context path is the default /.

You changed the context path for Jenkins to /jenkins. To access it via localhost you would use the URL http://127.0.0.1:8101/jenkins.

The proxy configuration needs to be updated:

ProxyPass /jenkins http://localhost:8101/jenkins nocanon
ProxyPassReverse /jenkins http://localhost:8101/jenkins
1
  • Thanks, changing this (with adding tabs instead of spaces) and restarting apache did it! Jan 29, 2016 at 16:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .