You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Kernel freak <ke...@gmail.com> on 2015/12/07 14:13:11 UTC
[users@httpd] Apache2 and Tomcat : Simultaneously running both servers and Virtual Hosting.
Hello friends,
I am working on some server side changes in which I have the webapps or
website hosted by Apache server is called by the URL. So if url is
www.domain-one.com, then the specific webapp or website must be served.
I have partial success in these regards as I have already configured Apache
Tomcat to host multiple webapps, and call them based on URL. It is working.
Now on to the 2nd stage of problem, where I have hosted a CMS on Apache
server, and would like to call it with a URL, *but also keep Apache tomcat
running in parallel*, and this is the main problem I am dealing with.
This may seem like a Apache server issue, but it's both, as I want to run
Apache web-server and Apache tomcat simultaneously with Virtual hosting. I
just hope there might be people here who know both servers.
I tried mod_jk without any luck. Here are the changes I made to tomcat and
apache server.
Tomcat changes : server.xml :
<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"
/>
Installed mod_jk with following command :
apt-get install libapache2-mod-jk
Created file workers.properties in /etc/apache2/
# Define 1 real worker using ajp13
worker.list=worker
# Set properties for worker (ajp13)
worker.worker.type=ajp13
worker.worker.host=localhost
worker.worker.port=8010
Instructed jk.conf to load this file :
JkWorkersFile /etc/apache2/workers.properties
Finally edited 000-default in sites-enabled to add :
JkMount /home/user/tomcat_directory/* worker1
Then restarted Apache2, and I got this 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!
I understand that Tomcat is running on 80, but how do I then configure
the servers so they can run simultaneously.
Kindly let me know..
Regards,
Akshay S.
Re: [users@httpd] Apache2 and Tomcat : Simultaneously running both
servers and Virtual Hosting.
Posted by William A Rowe Jr <wr...@rowe-clan.net>.
Pretty simple answer, you either,
1. Change the Tomcat port, E.g. 8080 so it doesn't collide with httpd, or
2. Listen (IPaddr1):80 to httpd and bind (IPaddr2):80 to Tomcat.
The second can be more confusing, since if you bind localhost:80 to Tomcat,
httpd won't respond unless you make a request to its own IP listener.
On Dec 7, 2015 07:13, "Kernel freak" <ke...@gmail.com> wrote:
> Hello friends,
>
> I am working on some server side changes in which I have the webapps or
> website hosted by Apache server is called by the URL. So if url is
> www.domain-one.com, then the specific webapp or website must be served.
>
> I have partial success in these regards as I have already configured
> Apache Tomcat to host multiple webapps, and call them based on URL. It is
> working.
>
> Now on to the 2nd stage of problem, where I have hosted a CMS on Apache
> server, and would like to call it with a URL, *but also keep Apache
> tomcat running in parallel*, and this is the main problem I am dealing
> with.
>
> This may seem like a Apache server issue, but it's both, as I want to run
> Apache web-server and Apache tomcat simultaneously with Virtual hosting. I
> just hope there might be people here who know both servers.
>
> I tried mod_jk without any luck. Here are the changes I made to tomcat and
> apache server.
>
> Tomcat changes : server.xml :
>
> <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"
> />
>
>
>
> Installed mod_jk with following command :
>
>
> apt-get install libapache2-mod-jk
>
> Created file workers.properties in /etc/apache2/
>
>
> # Define 1 real worker using ajp13
> worker.list=worker
> # Set properties for worker (ajp13)
> worker.worker.type=ajp13
> worker.worker.host=localhost
> worker.worker.port=8010
>
> Instructed jk.conf to load this file :
>
>
> JkWorkersFile /etc/apache2/workers.properties
>
>
> Finally edited 000-default in sites-enabled to add :
>
>
> JkMount /home/user/tomcat_directory/* worker1
>
> Then restarted Apache2, and I got this 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!
>
>
> I understand that Tomcat is running on 80, but how do I then configure the servers so they can run simultaneously.
>
> Kindly let me know..
>
> Regards,
>
> Akshay S.
>
>