Jenkins Apache configuration

apache-2.2Jenkins

I am trying to configure Jenkins on a local server I want to access from other machines in a local network.

Here is what I did so far: First, I configured the PREFIX in /etc/default/jenkins:

PREFIX=/jenkins

JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --prefix=$PREFIX"

and I reloaded Jenkins:

sudo /etc/init.d/jenkins force-reload

Thus, I can access Jenkins through http://localdomain:8080/jenkins. But I want to get rid of the :8080; therefore, I edited /etc/apache2/sites-available/jenkins as follow:

<VirtualHost *:80>
             ServerAdmin my.email@address
             ServerName localdomain
             ServerAlias localdomain
             ProxyPreserveHost on
             ProxyPass         /jenkins  http://localdomain:8080/jenkins nocanon
             ProxyPassReverse  /jenkins  http://localdomain:8080/jenkins
             ProxyRequests     Off
             AllowEncodedSlashes NoDecode

             <Proxy http://localdomain/jenkins*>
             Order deny,allow
             Allow from all
             </Proxy>
</VirtualHost>

following different tutorials I found here and there. I then reloaded Apache, but if I can still acess Jenkins through http://localdomain:8080/jenkins, when I try to access it through http://localdomain/jenkins, I get a 404 error. I checked the Apache error logs, and here is what I found:

[Mon Jan 05 11:41:02 2015] [error] [client xxx.xxx.x.xxx] File does not exist: /var/www/jenkins

Have you any idea of what I did wrong? What should I do to get it working?

Edit:

mod_proxy is installed and running, and apache2ctl -S returns

/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server localdomain (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost localdomain (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost localdomain (/etc/apache2/sites-enabled/jenkins:1)
Syntax OK

Best Answer

In my case, the problem is that the default configuration of Apache is superseding the Jenkins configuration.

A simple sudo a2dissite default; sudo service apache2 reload is then enough to make it works.