IP Based Virtual Hosting / Tomcat

Discussion in 'Java' started by skijor, Feb 10, 2008.

  1. skijor

    skijor Guest

    Hi,
    I use Tomcat 6.0.10 as a stand-alone web application server (not
    sitting behind Apache httpd). I host several domains on a single
    physical host using name-based virtual hosting set up in server.xml.
    I need to enable ssl for one of the domains. I understand I can no
    longer use name-based hosting with ssl.

    Is there a way to enable IP based hosting in tomcat directly or do I
    now have to run tomcat behind apache for ip hosting / ssl.?

    Thanks
     
    skijor, Feb 10, 2008
    #1
    1. Advertising

  2. skijor

    skijor Guest


    > Is there a way to enable IP based hosting in tomcat directly


    yes. Minimally add a DNS entry to your hosts file:

    10.0.1.200 my.subdomain.com

    then, add useIPVHosts="true" to your SSL HTTP/1.1 connector

    keep the Named Based Virtual Host the same:

    <Host name="my.subdomain.com" appBase="webapps/myApp-1.0.0"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" docBase="." debug="1"/>
    </Host>

    Note: If you are going to host more than one domain over https, you
    will need to create another ethernet device with
    a new LAN IP (for unix, google the 'ifconfig' command). Then add the
    new ip/domain name mapping to the host file:

    10.0.1.201 my.subdomain2.com
     
    skijor, Feb 10, 2008
    #2
    1. Advertising

  3. skijor

    wheresjim Guest

    That's great! I am not using this for SSL, but rather I want a second
    webapp folder for staging and want to use the same named URL but with
    different IP adresses and choose which webapps folder to use based on
    IP, regardless of name.

    So just as you said, I added useIPVHosts="true" to my connector such
    that:

    <Connector port="80" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25"
    maxSpareThreads="75"
    redirectPort="443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true"
    useIPVHosts="true"/>

    Then I added set the virtual hosts such that:

    <Host name="deploy.mywebserver.com" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false"> ... </Host>

    <Host name="staging.mywebserver.com" appBase="webapps-staging"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false"> ... </Host>

    Then I made the following additions to my hosts file:

    192.168.12.201 staging.mywebserver.com
    [my outside ipaddress] deploy.mywebserver.com

    Now whenever I test, I just set my client's hosts file to:

    192.168.12.201 deploy.mywebserver.com

    And I can test without disrupting my deployment server.

    Thanks!

    Jim
     
    wheresjim, Feb 26, 2008
    #3
  4. skijor

    Guest

    my hosts like this£º

    www.domain1.com ----> ip1
    www.domain2.com -----> ip2

    jdk 1.6
    tomcat 6.0.16
    windows 2003(64bit)

    2 ssl

    when i type : https://www.domain1.com the ssl is for www.domain2.com .

    can not Matching !

    is there some things error ???



    On 2ÔÂ11ÈÕ, ÉÏÎç4ʱ26·Ö, skijor <> wrote:
    > > Is there a way to enable IP based hosting in tomcat directly

    >
    > yes. Minimally add a DNS entry to your hosts file:
    >
    > 10.0.1.200 my.subdomain.com
    >
    > then, add useIPVHosts="true" to your SSL HTTP/1.1 connector
    >
    > keep the Named Based Virtual Host the same:
    >
    > <Host name="my.subdomain.com" appBase="webapps/myApp-1.0.0"
    > unpackWARs="true" autoDeploy="true"
    > xmlValidation="false" xmlNamespaceAware="false">
    > <Context path="" docBase="." debug="1"/>
    > </Host>
    >
    > Note: If you are going to host more than one domain over https, you
    > will need to create another ethernet device with
    > a new LAN IP (for unix, google the 'ifconfig' command). Then add the
    > new ip/domain name mapping to the host file:
    >
    > 10.0.1.201 my.subdomain2.com
     
    , Mar 11, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flip
    Replies:
    0
    Views:
    429
  2. Joe
    Replies:
    0
    Views:
    1,719
  3. Jayant patil

    Virtual hosting with tomcat

    Jayant patil, Mar 1, 2005, in forum: Java
    Replies:
    4
    Views:
    695
    Jayant patil
    Mar 2, 2005
  4. Remi Delon
    Replies:
    0
    Views:
    827
    Remi Delon
    Jan 19, 2005
  5. teo1991
    Replies:
    0
    Views:
    649
    teo1991
    Apr 2, 2009
Loading...

Share This Page