title: Tomcat, Httpd : Running both at same time and calling based upon URL.
body: <p>I am working on Debian X64 where I have tomcat with multiple webapps hosted which works fine. </p>
  
  <p>I have an Apache webserver running which is hosting a <code>CMS</code> and which I would like to open when for example <code>www.domain-cms.com</code> is called. 
  Right now, the Tomcat has 2 webapps which are called again based upon URL like <code>www.domain-tom1.com</code> and <code>www.domain-tom2.com</code></p>
  
  <p>Now my question is how to run both together and distinguish based upon URL. I have done the following changes, kindly let me know what am I missing. </p>
  
  <p>Tomcat's server.xml :</p>
  
  <pre><code> &lt;Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat"&gt;
  
  &lt;Connector port="80" protocol="org.apache.coyote.http11.Http11NioProtocol" compression="force" compressionMinSize="1024" 
                 connectionTimeout="20000"  maxPostSize="5242880"
                 URIEncoding="utf-8"
   compressableMimeType="text/html,text/xml,text/plain,text/css,text/ javascript,application/x-javascript,application/javascript"/&gt;
  
  
  &lt;Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"  maxPostSize="5242880" SSLEnabled="true" maxThreads="200" compre$
                compressionMinSize="1024" scheme="https" secure="true" clientAuth="false"  sslProtocol="TLS"
                 keystoreFile="keystorefile" keystorePass="PASSWORD" URIEncoding="utf-8"
   compressableMimeType="text/html,text/xml,text/plain,text/css,text/ javascript,application/x-javascript,application/javascript"/&gt;
  
  
  
   &lt;Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true"/&gt;
          &lt;Host name="domain-first.com" autoDeploy="true" unpackWARs="true" appBase="tooltank_webapps"&gt;
                  &lt;Alias&gt;www.domain-first.com&lt;/Alias&gt;
                  &lt;Context path=""/&gt;
          &lt;/Host&gt;
  
          &lt;Host name="domain-second.com" autoDeploy="true" unpackWARs="true" appBase="aupair_webapps"&gt;
                  &lt;Alias&gt;www.domain-second.com&lt;/Alias&gt;
                  &lt;Context path=""/&gt;
  
  
      &lt;/Host&gt;
      &lt;Connector port="8010" protocol="AJP/1.3" redirectPort="443" URIEncoding="utf-8"
   compressableMimeType="text/html,text/xml,text/plain,text/css,text/ javascript,application/x-javascript,application/javascript"
  /&gt;
  &lt;/Engine&gt;
  </code></pre>
  
  <p>apache2.conf :</p>
  
  <p>I have added this in it, but seems wrong as I want to redirect based upon URL, but don't know what to add.</p>
  
  <pre><code>&lt;IfModule jk_module&gt;
  
    JkWorkersFile /etc/apache2/workers.properties 
    JkLogLevel INFO 
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories 
  
  // I think below is wrong, I want to redirect based on URL.
    SetEnvIf Request_URI "/error/*" no-jk
    SetEnvIf Request_URI "/blog*"   no-jk
  
    JkMount    /                    tomcat
    JkMount    /*                   tomcat
  
  &lt;/IfModule&gt;
  (END)
  </code></pre>
  
  <p>workers.properties file :</p>
  
  <pre><code>  worker.list=tomcat
   # Set properties for worker (ajp13) 
  
   worker.worker.type=ajp13 
   worker.worker.host=127.0.0.1
   worker.worker.port=8010
  (END)
  </code></pre>
  
  <p>Now whenever I try to start Apache, I get an error :</p>
  
  <pre><code>[....] Restarting web server: apache2(98)Address already in use: make_sock: could not bind to address [::]:80
  (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
  no listening sockets available, shutting down
  Unable to open logs
  Action 'start' failed.
  The Apache error log may have more information.
   failed!
  </code></pre>
  
  <p>How can I connect both Apache server and tomcat and serve CMS and webapps in parallel based upon URL. Kindly let me know. Thank you. :-)</p>