Skip to main content

Running Hudson behind an Apache Server: a primer

Posted by johnsmart on May 31, 2010 at 11:59 AM PDT

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 rather than 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, 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 and mod_proxy_ajp modules are activated. In your httpd.conf
file (often in the /etc/httpf/conf directory), you should have the following line:
LoadModule proxy_module modules/

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:

LoadModule proxy_ajp_module modules/
ProxyPass /hudson http://localhost:8081/hudson
/hudson http://localhost:8081/hudson

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

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.

Related Topics >>

Comments not needed in your setup

Hello, you only use the http proxy approach and not ajp. Right now it is not possible to connect to winstone ajp with mod_proxy_ajp, only mod_jk will work, see Regards Mirko


 Thanks - you're right, of course. The 'LoadModules' line is not necessary here, as for the standalone version of Hudson (used in this example), you have to use the standard mod-proxy configuration.