title: configure tomcat7 and apache2
body: <p>So I have tried several tutorials, however I am missing something and I hope someone could help me. </p>
  
  <p>I have an <strong>ubuntu 12.04</strong> server running with <strong>tomcat7</strong> and <strong>apache2</strong> and I am trying to reach an application (JSF 2.2) running on tomcat via apache2.</p>
  
  <p>The application running on tomcat is working perfectly fine if I am accessing it like this: <em>example.com:8080/demo</em>.</p>
  
  <p>I am trying to access it via apache2 on the following URL: <em>demo.example.com</em></p>
  
  <p>So far the main page is loading, but the navigation within the application is not.</p>
  
  <p>If the application is sending me to <em>example.com:8080/demo/page2.xhtml</em> <strong>instead of <em>demo.example.com/page2.xhtml</em></strong> I am somehow redirected to 
  <strong>demo.example.com/demo/page2.xhtml</strong> and get a HTTP Status 404.</p>
  
  <p>And now the million dollar question: what am I doing wrong?</p>
  
  <p>Here is my <strong>httpd.conf</strong> file:</p>
  
  <pre><code>&lt;VirtualHost demo.mydomain.com:80&gt;
      ProxyRequests Off
      ProxyPreserveHost On
  
      ProxyPass / ajp://localhost:8009/demo/
      ProxyPassReverse / ajp://localhost:8009/demo/
  
      &lt;Proxy *&gt;
              AddDefaultCharset Off
              Order deny,allow
              Allow from all
      &lt;/Proxy&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>In the <strong>server.xml</strong> from tomcat7 I added the following entry:</p>
  
  <pre><code>&lt;Connector port="8009" URIEncoding="UTF-8" protocol="AJP/1.3" redirectPort="8080"/&gt;
  </code></pre>
  
  <p>In the <strong>libapache2-mod-jk "workers.properties"</strong> I have the following entries:</p>
  
  <pre><code>workers.tomcat_home=/var/lib/tomcat7
  workers.java_home=/usr/lib/jvm/java-8-oracle
  ps=/
  worker.list=ajp13_worker
  worker.ajp13_worker.port=8009
  worker.ajp13_worker.host=localhost
  worker.ajp13_worker.type=ajp13
  worker.ajp13_worker.lbfactor=1
  worker.loadbalancer.type=lb
  worker.loadbalancer.balance_workers=ajp13_worker
  </code></pre>