Skip to content

Wakaleo Consulting

  Home Blog Running Hudson behind an Apache Server: a primer
  • Expertise in Continuous Integration and Continuous Delivery
  • Training and Mentoring in Test Driven Development
  • Training and Mentoring in Test Driven Development
  • Training and Mentoring in Test Driven Development
  • Expert Jenkins/Hudson training and mentoring
  • Expertise in Automated Acceptance Tests and ATDD
  • Expertise in quality development and testing practices
  • Training and Mentoring in Test Driven Development
  • Expertise in Continuous Integration and Continuous Deployment
Running Hudson behind an Apache Server: a primer PDF Print E-mail
Wednesday, 26 May 2010 11:26

If you are running Hudson in a Unix environment, you may want to hide it behind an Apache HTTP server in order to harmonize the server URLs and simplify maintenance and access. This way, users can access the Hudson server using a URL like http://myserver.myorg.com/hudson rather than http://myserver.myorg.com:8081. One way to do this is to use the Apache mod_proxy and mod_proxy_ajp modules. In this article, we discuss one approach.

The exact configuration of this module will vary depending on the details of your Apache version and installation details, but one possible approach is outlined here:

First, if you are running Hudson as a stand-alone application, make sure you start up Hudson using the --prefix option. The prefix you choose must match the suffix in the public-facing URL you want to use. So if you want to access Hudson via a URL like http://myserver.myorg.com/hudson, you will need to provide 'hudson' as a prefix:

$ java -jar hudson.war --httpPort=8081 --ajp13Port=8010 --prefix=hudson
If you are running Hudson on an application server such as Tomcat, Hudson will already have its own web context ("/hudson" by default)

Next, make sure the mod_proxy module is activated. In your httpd.conf file (often in the /etc/httpf/conf directory), you should have the following line:

LoadModule proxy_module modules/mod_proxy.so

The proxy is actually configured in the proxy_ajp.conf file (often in the /etc/httpd/conf.d directory). An example of such a configuration file is given here:

ProxyPass /hudson http://localhost:8081/hudson
ProxyPassReverse /hudson http://localhost:8081/hudson
ProxyRequests Off

Once this is done, you just need to restart your Apache server:

$ sudo /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
Now you should be able to access your Hudson server using a URL like http://myserver.myorg.com/hudson.

This is one approach - there are others. I'd be curious to hear about alternative configurations that people are using or issues people have come across.

Tags See All Tags Add New Tag...

Please Enter New Tags Separated By Comma's
  Or Close

Continuous Integration  Hudson 

Trackback(0)
Comments (1)Add Comment
0
prefix wrong
written by ben, April 02, 2011
In my version of hudson, --prefix must be set to "/hudson" not just "hudson" (adding the front slash).

Write comment

busy