Here is what I have:
1 - Apache stack running on port 80.
http://myserver
2 - Jenkins(Hudson) build server running in servlet on same machine on port 8080.
http://myserver:8080
3 - httpd.conf
-----------------
...
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
...
#Attempt to get reverse proxy working for jenkins 8080
# version LIBXML2_2.6.27 not defined in file libxml2
#http://blog.sam-pointer.com/2009/11/17/building-and-installing-mod_proxy_html-and-mod_xml2enc
LoadFile /usr/lib/libxml2.so
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule xml2enc_module modules/mod_xml2enc.so
...
Include conf/proxy_html.conf
4 - proxy_html.conf
-----------------
ProxyRequests Off
ProxyPass /jenkins/ http://localhost:8080/
ProxyPass /jenkins http://localhost:8080
<Location /jenkins/>
ProxyPassReverse /
ProxyHTMLEnable On
ProxyHTMLURLMap http://localhost:8080/ /jenkins/
ProxyHTMLURLMap / /jenkins/
</Location>
Any tips or suggestions are much appreciated. Thanks in advance,
-Ed
<VirtualHost *:80>
ServerName ci.home.blah
ServerAlias ci
Redirect / http://ci.home.blah/jenkins/
ProxyPass /jenkins http://localhost:8080/jenkins
ProxyPassReverse /jenkins http://localhost:8080/jenkins
ErrorLog "/var/log/www/ci-home-error_log"
CustomLog "/var/log/www/ci-home-access_log" common
</VirtualHost>
> This is mine - you can ignore the redirect, that's just a convenience,
> just note that none of the URLs end with /
>
> <VirtualHost *:80>
> ServerName ci.home.blah
> ServerAlias ci
> Redirect / http://ci.home.blah/jenkins/
> ProxyPass /jenkins http://localhost:8080/jenkins
> ProxyPassReverse /jenkins http://localhost:8080/jenkins
> ErrorLog "/var/log/www/ci-home-error_log"
> CustomLog "/var/log/www/ci-home-access_log" common
> </VirtualHost>
I think I am getting closer:
These URL's now work:
http://localhost/jenkins
http://localhost/jenkins/
How can I make these URL's:
http://localhost
http://localhost/
go back to resolving to:
http://localhost/index.php/Main_Page
Sorry, for my Apache inexperience. Without the redirect, my image links break.
Here's what I have:
File: httpd-vhosts.conf
-------------------------
NameVirtualHost *:80
<VirtualHost *:80>
ProxyPass /jenkins http://localhost:8080
ProxyPassReverse /jenkins http://localhost:8080
Redirect / http://localhost/jenkins/
</VirtualHost>
File: httpd.conf
-------------------------
…
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
...
Thank you for taking the time to post your example!
-Ed
-Ed
> ...
> # Virtual hosts
> Include conf/extra/httpd-vhosts.conf
> ...
>
>
> Thank you for taking the time to post your example!
>
> -Ed
>
>
Remove the redirect.
Check that your Jenkins URL in Manage Jenkins > Configure System =
http://<your-hostname>/jenkins/
Bap.
Quoting Ed Sutton <ESu...@fescorp.com<mailto:ESu...@fescorp.com>>:
Remove the redirect.
Check that your Jenkins URL in Manage Jenkins > Configure System =
http://<your-hostname>/jenkins/
I expect that is the problem. I can not find this setting under Configure System? The only Jenkins URL setting I see is under Configure System is the E-Mail Notification settings a value used to put links into e-mails generated by Jenkins.
I am using Jenkins 1.397 native package that intsalls the Winstone servlet under Red Hat Enterprise Linux (5.2). Is the URL it set differently when using the Winstone servlet?
Thank you for your time,
-Ed
Bap.
-Ed
-Ed
-Ed
>
> On Apr 12, 2011, at 12:12 PM, Bap wrote:
>
> Quoting Ed Sutton <ESu...@fescorp.com<mailto:ESu...@fescorp.com>>:
>
> Remove the redirect.
>
> Check that your Jenkins URL in Manage Jenkins > Configure System =
> http://<your-hostname>/jenkins/
>
> I expect that is the problem. I can not find this setting under
> Configure System? The only Jenkins URL setting I see is under
> Configure System is the E-Mail Notification settings a value used to
> put links into e-mails generated by Jenkins.
Yep, that's the one. It is a little confusing with it being in the
E-mail section, but that is where you tell Jenkins how to refer to
itself.
The quick fix for this is to make an empty jenkins directory under your
default documentroot. Apache will automatically redirect a url path
that doesn't include the necessary trailing / but refers to a directory
back to one that does to make subsequent relative references work. Or
if that isn't convenient, use a RewriteRule to force the redirect yourself.
By the way, you could also use the ajp protocol to jenkin's ajp port in
the proxypass directive. I'm not sure if it makes any real difference
but it is theoretically more efficient.
--
Les Mikesell
lesmi...@gmail.com
Thank you both for your help. Unfortunately I can not seem to find the right combination to make it work. I tried making an empty jenkins directory under my DocumentRoot. The the best I have been able to do is:
ProxyRequests Off
ProxyPass /jenkins/ http://localhost:8080/
<Location /jenkins/>
ProxyPassReverse /
ProxyHTMLEnable On
ProxyHTMLURLMap http://localhost:8080/ /jenkins/
ProxyHTMLURLMap / /jenkins/
</Location>
This works for http://localhost/jenkins/ and automatically adds a trailing slash for http://localhost/jenkins and all the Jenkins links work. The problem is when I go to Manage Jenkins it says "It appears that your reverse proxy set up is broken." and refers me to https://wiki.jenkins-ci.org/display/JENKINS/Running+Jeankins+behind+Apache
It looks like there are a many combinations that may work. I just can not seem to find one that works for me. It's frustrating that I cannot get this to work after all the time spent working on this. Apache is interesting and powerful but I must be missing something fundamental. Thanks again for your time.
-Ed
I'm still running an old pre-fork hudson and the apache side isn't set
up for named vhosts but the apache config has:
ProxyPass /hudson/ ajp://localhost:8010/hudson/
and hudson is started with options of "--prefix=/hudson --ajp13Port=8010".
I think that's all it takes.
--
Les Mikesell
lesmi...@gmail.com
>
> >I'm still running an old pre-fork hudson and the apache side isn't set
> up for named vhosts but the apache config has:
>
> ProxyPass /hudson/ ajp://localhost:8010/hudson/
>
> and hudson is started with options of "--prefix=/hudson --ajp13Port=8010".
>
> I think that's all it takes.
>
That's it! The prefix option!
I added JENKINS_ARGS="--prefix=/jenkins" to my /etc/sysconfig/jenkins file and set my Apache httpd.conf to:
ProxyPass /jenkins http://localhost:8080/jenkins
ProxyPassReverse /jenkins http://localhost:8080/jenkins
ProxyRequests Off
# Local reverse proxy authorization override
# Most unix distribution deny proxy by default (ie /etc/apache2/mods-enabled/proxy.conf in Ubuntu)
<Proxy http://localhost:8080/jenkins*>
Order deny,allow
Allow from all
</Proxy>
I have not tried the AJP change. If my Jenkins servlet http port is 8080, should my AJP port also be 8080?
Anyway, it's all good now! Thank you for your patience and sticking with me!
-Ed
You might have gotten by without that if you had a
ProxyPassReverse / http://localhot:8080/jenkins
(i.e. the same as the ProxyPass), but it seems cleaner to let the webapp
know where it is rooted. The side effect is that if you go direct to
port 8080 you have to use the /jenkins location. This also makes it
straightforward to run multiple instances. The same apache could proxy
/jenkins-dev to a different server on a different port.
> ProxyPass /jenkins http://localhost:8080/jenkins
> ProxyPassReverse /jenkins http://localhost:8080/jenkins
> ProxyRequests Off
> # Local reverse proxy authorization override
> # Most unix distribution deny proxy by default (ie /etc/apache2/mods-enabled/proxy.conf in Ubuntu)
> <Proxy http://localhost:8080/jenkins*>
> Order deny,allow
> Allow from all
> </Proxy>
>
> I have not tried the AJP change. If my Jenkins servlet http port is 8080, should my AJP port also be 8080?
No, it is a different protocol and needs a different port. I don't know
the internals but I think is just has a bit less overhead than http -
probably nothing you'd ever notice. I think most java web containers
offer the option.
--
Les Mikesell
lesmi...@gmail.com
> On 4/13/2011 8:00 AM, Ed Sutton wrote:
>>
>>>> I'm still running an old pre-fork hudson and the apache side isn't set
>>> up for named vhosts but the apache config has:
>>>
>>> ProxyPass /hudson/ ajp://localhost:8010/hudson/
>>>
>>> and hudson is started with options of "--prefix=/hudson --ajp13Port=8010".
>>>
>>> I think that's all it takes.
>>>
>>
>> That's it! The prefix option!
>>
>> I added JENKINS_ARGS="--prefix=/jenkins" to my /etc/sysconfig/jenkins file and set my Apache httpd.conf to:
>
> >You might have gotten by without that if you had a
> ProxyPassReverse / http://localhot:8080/jenkins
> (i.e. the same as the ProxyPass), but it seems cleaner to let the webapp
> know where it is rooted. The side effect is that if you go direct to
> port 8080 you have to use the /jenkins location.
Yes, I noticed that /jenkins was now required. I can live with that but may try the ProxyPass/Reverse method one more time.
> >This also makes it
> straightforward to run multiple instances. The same apache could proxy
> /jenkins-dev to a different server on a different port.
That's kind of what I had in mind. Installing various Bitnami web apps to experiment with.
>
>> ProxyPass /jenkins http://localhost:8080/jenkins
>> ProxyPassReverse /jenkins http://localhost:8080/jenkins
>> ProxyRequests Off
>> # Local reverse proxy authorization override
>> # Most unix distribution deny proxy by default (ie /etc/apache2/mods-enabled/proxy.conf in Ubuntu)
>> <Proxy http://localhost:8080/jenkins*>
>> Order deny,allow
>> Allow from all
>> </Proxy>
>>
>> I have not tried the AJP change. If my Jenkins servlet http port is 8080, should my AJP port also be 8080?
>
> >No, it is a different protocol and needs a different port. I don't know
> the internals but I think is just has a bit less overhead than http -
> probably nothing you'd ever notice. I think most java web containers
> offer the option.
Thank you for your explanations and assistance. I have a lot to learn but hopefully, unlike Microsoft technologies, what I learn today won't be obsolete in 2 or 3 years and be replaced with something completely different. ;-)
-Ed