jenkins the definitive guide

(Jeff_L) #1

On a real server, you would typically have set up security, so that only a system administrator could
access this URL. In this case, you will need to provide a username and a password:


$ wget --user=admin --password=secret http://localhost:8080/exit

Note that you can actually do this from a different server, not just the local machine:


$ wget --user=admin --password=secret http://buildserver.acme.com:8080/exit

Note that while both these methods will shut down Jenkins relatively cleanly (more so than killing the
process directly, for example), they will interrupt any builds in progress. So it is recommended practice
to prepare the shutdown cleanly by using the Prepare for Shutdown button on the Manage Jenkins screen
(see Section 4.2, “The Configuration Dashboard—The Manage Jenkins Screen”).


Running Jenkins as a stand-alone application may not be to everyone’s taste. For a production server,
you might want to take advantage of the more sophisticated monitoring and administration features of
a full blown Java application server such as JBoss, GlassFish, or WebSphere Application Server. And
system administrators may be wary of the relatively little-known Winstone server, or may simply prefer
Jenkins to fit into a known pattern of Java web application development. If this is the case, you may
prefer to, or be obliged to, deploy Jenkins as a standard Java web application. We look at this option
in the following section.


3.9. Running Jenkins Behind an Apache Server


If you are running Jenkins 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 Jenkins server using a URL like http://myserver.myorg.com/jenkins rather than http://
myserver.myorg.com:8081.


One way to do this is to use the Apache mod_proxy and mod_proxy_ajp modules. These modules let
you use implement proxying on your Apache server using the AJP13 (Apache JServer Protocol version
1.3). Using this module, Apache will transfer requests to particular URL patterns on your Apache server
(running on port 80) directly to the Jenkins server running on a different port. So when a user opens
a URL like http://www.myorg.com/jenkins, Apache will transparently forward traffic to your Jenkins
server running on http://buildserver.myorg.com:8081/jenkins.Technically, this is known as “Reverse
Proxying,” as the client has no knowledge that the server is doing any proxying, or where the proxied
server is located. So you can safely tuck your Jenkins server away behind a firewall, while still providing
broader access to your Jenkins instance via the public-facing URL.


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


First of all, if you are running Jenkins as a stand-alone application, make sure you start up Jenkins using
the --prefix option. The prefix you choose must match the suffix in the public-facing URL you want

Free download pdf