Problem with adding a "--prefix=/jenkins" to a Jenkins configuration

1,156 views
Skip to first unread message

JenkinsGer

unread,
Jan 3, 2014, 6:36:39 AM1/3/14
to jenkins...@googlegroups.com
Good day,

I think this mailing list is the best place to post my problem:

I am running Jenkins on my own web-server (Ubuntu with Apache2) that is accessible by dyndns over port 444 of my router. My goal is to reach Jenkins by using the following SSL-URL:

     https://myPrivateURL.dyndns-office.com:444/jenkins/
 

So I configured my Apache like this:

     <virtualhost *:443>
     SSLEngine On
     SSLCertificateFile /etc/apache2/ssl/apache.pem

     <Proxy *>
    
     Order deny,allow
    
     Allow from all
     </Proxy>

     ProxyRequests Off
     ProxyPass /jenkins/ http://localhost:8080/
     ProxyPassReverse /jenkins/ http://localhost:8080/
    
</virtualhost>

This makes Jenkins accessible if I enter https://myPrivateURL.dyndns-office.com:444/jenkins/ within my browser. However, not all links within the Jenkins-pages are correct. Consider the menu entries to the left including “New Job” or “Manage Jenkins”. E.g. “Manage Jenkins” refers to

     https://myPrivateURL.dyndns-office.com:444/manage 


However, the URL should include “jenkins” within the path. The following URL would be the right one (and works if manually entered)

     https://myPrivateURL.dyndns-office.com:444/jenkins/manage 


How do I configure Jenkins so that a prefix is used to build the Jenkins-URLs? Here is what I tried:

  1. I opened /etc/default/jenkins and appended “--prefix=/jenkins/” to JENKINS_ARGS
  2. I added https://myPrivateURL.dyndns-office.com:444/jenkins/ as <hudsonUrl> in hudson.tasks.Mailer.xml


However, if I try to open https://myPrivateURL.dyndns-office.com:444/jenkins/ adding the prefix and restarting Jenkins I always get the same error message:

It does not matter what I enter as a prefix. Even if I use “abcdefg” as the prefix the error message remains the same. /var/log/jenkins/jenkins.log simply says

     [Winstone 2014/01/02 XX:XX:XX] - Request URL / not found - doesn't match any webapp prefix

So I am not sure whether my apache2 is configured wrong or whether this is a problem with jenkins? I really appriciate any help!

Les Mikesell

unread,
Jan 3, 2014, 8:48:15 AM1/3/14
to jenkinsci-users
On Fri, Jan 3, 2014 at 5:36 AM, JenkinsGer <mr.l...@gmail.com> wrote:
>
> Good day,
>
> I think this mailing list is the best place to post my problem:
>
> I am running Jenkins on my own web-server (Ubuntu with Apache2) that is accessible by dyndns over port 444 of my router. My goal is to reach Jenkins by using the following SSL-URL:
>
> https://myPrivateURL.dyndns-office.com:444/jenkins/
>
>
> So I configured my Apache like this:
>
> <virtualhost *:443>

Did you mean 444 here to match your URL examples?

> SSLEngine On
> SSLCertificateFile /etc/apache2/ssl/apache.pem
>
> <Proxy *>
> Order deny,allow
> Allow from all
> </Proxy>
>
> ProxyRequests Off
> ProxyPass /jenkins/ http://localhost:8080/
> ProxyPassReverse /jenkins/ http://localhost:8080/

Add the same path as you use in --prefix to the target URL here. That is:

ProxyPass /jenkins/ http://localhost:8080/jenkins/
ProxyPassReverse /jenkins/ http://localhost:8080/jenkins/

> </virtualhost>
>
> This makes Jenkins accessible if I enter https://myPrivateURL.dyndns-office.com:444/jenkins/ within my browser. However, not all links within the Jenkins-pages are correct. Consider the menu entries to the left including “New Job” or “Manage Jenkins”. E.g. “Manage Jenkins” refers to
>
> https://myPrivateURL.dyndns-office.com:444/manage
>
>
> However, the URL should include “jenkins” within the path. The following URL would be the right one (and works if manually entered)
>
> https://myPrivateURL.dyndns-office.com:444/jenkins/manage
>
>
> How do I configure Jenkins so that a prefix is used to build the Jenkins-URLs? Here is what I tried:
>
> I opened /etc/default/jenkins and appended “--prefix=/jenkins/” to JENKINS_ARGS
> I added https://myPrivateURL.dyndns-office.com:444/jenkins/ as <hudsonUrl> in hudson.tasks.Mailer.xml
>
>
> However, if I try to open https://myPrivateURL.dyndns-office.com:444/jenkins/ adding the prefix and restarting Jenkins I always get the same error message:
>
> It does not matter what I enter as a prefix. Even if I use “abcdefg” as the prefix the error message remains the same. /var/log/jenkins/jenkins.log simply says
>>
>> [Winstone 2014/01/02 XX:XX:XX] - Request URL / not found - doesn't match any webapp prefix
>
> So I am not sure whether my apache2 is configured wrong or whether this is a problem with jenkins? I really appriciate any help!

Adding --prefix=/jenkins to the jenkins config moves the url from the
default :8080/ to :8080/jenkins/. Change the Apache proxy config to
match and everything will work.

--
Les Mikesell
lesmi...@gmail.com

JenkinsGer

unread,
Jan 3, 2014, 9:06:43 AM1/3/14
to jenkins...@googlegroups.com
First:


>> Did you mean 444 here to match your URL examples? 

No, I map Port 444 to 443 (done by my router).

Second:

Thank you so much! Your answer indeed solved my problem. I spent hours trying to identify this small last mistake. Thanks!!
Reply all
Reply to author
Forward
0 new messages