tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kernel freak <kernelfr...@gmail.com>
Subject Re: Tomcat, Apache web-server : Simultaneously running both servers and Virtual Hosting.
Date Tue, 08 Dec 2015 08:36:02 GMT
Hi Chris,

I just saw your mail, although I was able to solve this problem yesterday
before leaving. This is what I did. I just waned to know, if this
configuration will also work if I am using https. Thank you.

Here is what I did :

Tomcat's server.xml :


 <Connector port="8080" proxyPort="80" redirectPort="443"
protocol="HTTP/1.1" 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" compr$
              compressionMinSize="1024" scheme="https" secure="true"
clientAuth="false"  sslProtocol="TLS"
               keystoreFile="keystore.jks" keystorePass="PASSWORD"
URIEncoding="utf-8"
 compressableMimeType="text/html,text/xml,text/plain,text/css,text/
javascript,application/x-javascript,application/javascript"/>

  <Connector port="8010" protocol="AJP/1.3" redirectPort="80"
URIEncoding="utf-8"
 compressableMimeType="text/html,text/xml,text/plain,text/css,text/
javascript,application/x-javascript,application/javascript"
/>
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat">
   // Multiple webapps hosted
    </Engine>


Added this in jk.conf :


<IfModule jk_module>
        JkWorkersFile   /PATH/to/workers.properties
        JkLogFile       /var/log/apache2/mod_jk.log
        JkLogLevel      notice
        JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
        JkOptions       +ForwardURIProxy
        JkMountFile     /path/to/uriworkermap.properties
</IfModule>

workers.properties :


worker.list = worker_app1
worker.worker_app1.type = lb
worker.worker_app1.balance_workers = app1_instance1
worker.worker_app1.sticky_session = true
worker.worker_app1.sticky_session_force = false
worker.worker_app1.method = busyness

worker.app1_instance1.type = ajp13
worker.app1_instance1.host = 127.0.0.1
worker.app1_instance1.port = 8010
worker.app1_instance1.host = localhost
worker.app1_instance1.lbfactor = 1
worker.app1_instance1.socket_timeout = 40
worker.app1_instance1.socket_keepalive = true
worker.app1_instance1.reply_timeout = 30000

uriworkermap.properties :


/|/* = worker_app1;

Added this to 000-default in sites-enabled

// This is the tomcat domain.
<VirtualHost *:80>
ServerName www.domain_tomcat_webapp.de
ServerAlias domain_tomcat_webapp.de
ProxyRequests on
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

<Location / >
Order allow,deny
Allow from all
</Location>
</VirtualHost>



Will this config also work if the the request made is in https? Kindly
let me know. Thanks a lot. :-)







On Mon, Dec 7, 2015 at 8:55 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> Akshay,
>
> On 12/7/15 2:53 PM, Christopher Schultz wrote:
> > Akshay,
> >
> > On 12/7/15 5:26 AM, Kernel freak wrote:
> >> <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"/>
> >
> > You have configured Tomcat for ports 80 and 443. When you start httpd:
> >
> >> [....] 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!
> >
> > ... you get a port conflict. You have to choose: httpd or Tomcat on port
> > 80 (and 443).
> >
> >> I understand that Tomcat is running on 80, but how do I then configure
> >> the servers so they can run simultaneously.
> >
> > It looks like you started configuring for mod_jk, but didn't really
> > finish. What you have to do is proxy *all* applications from http ->
> > Tomcat. Then remove the HTTP <Connectors> from Tomcat and rely
> > exclusively on the AJP connector(s). (You really only need one single
> > AJP connector, since it will forward TLS information across to Tomcat.)
>
> Have a look at
>
> http://people.apache.org/~schultz/ApacheCon%20NA%202015/Load-balancing%20Tomcat%20with%20mod_jk.pdf
> starting at slide 19.
>
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message