I am trying to set-up jenkins behind apache2 (Both fresh install with the package manager) OS used : ubuntu 12.04 LTS
Actually I am setting up a couple services behind this Apache. First is artifactory. Here my site file
<VirtualHost *:80>
ServerAdmin anEmail@SomeDomain.com
DocumentRoot "/var/www"
ServerName aDomain.com
ErrorLog "/path/to/artifactoryVirtualHost.log"
ProxyRequests off
ProxyPass /artifactory http://127.0.0.1:8081/artifactory
ProxyPassReverse /artifactory http://127.0.0.1:8081/artifactory
ProxyPreserveHost on
</VirtualHost>
It is working as intended when I go to aDomain.com/artifactory it redirect me to the artifactory embedded tomcat.
Here is my jenkins site file
<VirtualHost *:80>
ServerAdmin anEmail@SomeDomain.com
DocumentRoot "/var/www"
ServerName aDomain.com
ErrorLog "/path/to/jenkinsVirtualHost.log"
ProxyRequests off
ProxyPass /jenkins ajp://127.0.0.1:8102/jenkins
ProxyPassReverse /jenkins ajp://127.0.0.1:8102/jenkins
ProxyPreserveHost on
</VirtualHost>
Notice the difference here I am using AJP connector here since jenkins allow it without much configuration. Also jenkins require a bit more configuration
in my /etc/default/jenkins file
JENKINS_ARGS="--webroot=$JENKINS_RUN/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --preferredClassLoader=java.net.URLClassLoader **--prefix=/jenkins**
HTTP_PORT -1
AJP_PORT : 8102
I disable the http since I want my user to go trough Apache And I also added the prefix jenkins as written in the jenkins manual. Unfortunately I am doing something wrong because when I go to aDomain.com/jenkins Apache serve me a 404 which make me a sad panda.
More information: I'm doing this as a test on a virtual machine, I am using:
Linux hostname 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Server version: Apache/2.2.22 (Ubuntu)
Jenkins ver. 1.509.2
Also I loaded those on Apache2
sudo a2enmode proxy
sudo a2enmode proxy_http
sudo a2enmode proxy_ajp
Edit: I forgot to let you know that my httpd.conf is an empty file
Thank you for your time
Best Answer
this is a working config behind a reverse proxy apache2 in centos 6 that also does ssl/tls offloading: