jenkins the definitive guide

(Jeff_L) #1

to use. So if you want to access Jenkins via the URL http://myserver.myorg.com/jenkins, you will need
to provide jenkins as a prefix:


$ java -jar jenkins.war --httpPort=8081 --ajp13Port=8010 --prefix=jenkins

If you are running Jenkins on an application server such as Tomcat, it will already be running under a
particular web context (/jenkins 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/mod_proxy.so

The proxy is actually configured in the proxy_ajp.conf file (often in the /etc/httpd/conf.d
directory). Note that the name of the proxy path (/jenkins in this example) must match the prefix or
web context that Jenkins is using. An example of such a configuration file is given here:


LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

ProxyPass /jenkins http://localhost:8081/jenkins
ProxyPassReverse /jenkins http://localhost:8081/jenkins
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 Jenkins server using a URL like http://myserver.myorg.com/
jenkins.


3.10. Running Jenkins on an Application Server


Since Jenkins is distributed as an ordinary WAR file, it is easy to deploy it on any standard Java
application server such as Tomcat, Jetty, or GlassFish. Running Jenkins on an application server is
arguably more complicated to setup and to maintain. You also loose certain nice administration features
such as the ability to upgrade Jenkins or restart the server directly from within Jenkins. On the other
hand, your system administrators might be more familiar with maintaining an application running on
Tomcat or GlassFish than on the more obscure Winstone server.


Let’s look at how you would typically deploy Jenkins onto a Tomcat server. The easiest approach is
undoubtedly to simply unzip the Tomcat binary distribution onto your disk (if it is not already installed)
and copy the jenkins.war file into the Tomcat webapps directory. You can download the Tomcat
binaries from the Tomcat website^1.


(^1) http://tomcat.apache.org

Free download pdf