title: Apache & Tomcat: ProxyPass and ProxyPassReverse
body: <p>I'am having troubles configuring Apache and Tomcat, this is the scenario:</p>
  
  <p>I have an Apache Web Server, running and working normally, I can access to this one just typing:</p>
  
  <pre><code>http://localhost
  </code></pre>
  
  <p>Also, in this host, I have a Tomcat running and working fine; I've created a mini web-app which files are inside "prueba" directory, I can access typing:</p>
  
  <pre><code>http://localhost:8080/prueba
  </code></pre>
  
  <p>(I know that Apache is running in 80 port and Tomcat in 8080)</p>
  
  <p>What I want to do is that througt Apache an user can access to 'pruebas'(running on Tomcat), I mean:</p>
  
  <pre><code>http://localhost/prueba
  </code></pre>
  
  <p>I've readen a lot of this, and I think that there are 2 ways to do this, and I've decided enabling the proxy modules(proxy and proxy_ajp, with a2enmod), also I've readed I must edit this file: sites-available/default, this is the content:</p>
  
  <pre><code>NameVirtualHost *:80
  &lt;VirtualHost *:80&gt;
       ServerName 127.0.0.1
       DocumentRoot /var/www
  
       ProxyRequests Off
       ProxyPreserveHost On
  
       ProxyPass /static/ !
       ProxyPass / ajp://localhost:8009/
       ProxyPassReverse / ajp://localhost:8009/
  
  .
  .
  .
       Alias /static/ "/apache/www/"
  
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>But this hasn't work propperly :(</p>
  
  <p>I have to say that I've tried whit many changes, ont this 2 lines, like:</p>
  
  <pre><code>     ProxyPass /prueba ajp://localhost:8009/prueba
       ProxyPassReverse /prueba ajp://localhost:8009/prueba
  </code></pre>
  
  <p>or</p>
  
  <pre><code>     ProxyPass / ajp://localhost:8009/prueba
       ProxyPassReverse / ajp://localhost:8009/prueba
  </code></pre>
  
  <p>(each time I edit the file, I restart apache)</p>
  
  <p>But when I access to [http://localhost/prueba/], I have:
      Service Temporarily Unavailable</p>
  
  <p>Has anyone knows why?
  Thanks in advance guys.</p>
  
  <p>Pd: I'm working with apache 2.2.17 and tomcat6.</p>