I am working on Debian X64 where I have tomcat with multiple webapps hosted which works fine.
I have an Apache webserver running which is hosting a CMS
and which I would like to open when for example www.domain-cms.com
is called.
Right now, the Tomcat has 2 webapps which are called again based upon URL like www.domain-tom1.com
and www.domain-tom2.com
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.
Tomcat's server.xml :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat">
<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"/>
<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"/>
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"/>
<Host name="domain-first.com" autoDeploy="true" unpackWARs="true" appBase="tooltank_webapps">
<Alias>www.domain-first.com</Alias>
<Context path=""/>
</Host>
<Host name="domain-second.com" autoDeploy="true" unpackWARs="true" appBase="aupair_webapps">
<Alias>www.domain-second.com</Alias>
<Context path=""/>
</Host>
<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"
/>
</Engine>
apache2.conf :
I have added this in it, but seems wrong as I want to redirect based upon URL, but don't know what to add.
<IfModule jk_module>
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
</IfModule>
(END)
workers.properties file :
worker.list=tomcat
# Set properties for worker (ajp13)
worker.worker.type=ajp13
worker.worker.host=127.0.0.1
worker.worker.port=8010
(END)
Now whenever I try to start Apache, I get an error :
[....] 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!
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. :-)