opensubscriber
   Find in this group all groups
 
Unknown more information…

a : ajug-members@ajug.org 8 April 2012 • 9:37PM -0400

Re: [ajug-members] Running multiple sites off of a single tomcat server
by Bryan Pauquette

REPLY TO AUTHOR
 
REPLY TO GROUP




Ok so from a clean tomcat install in my user folder on windows 7 ultimate
service pack 1.

Step 1) Go to http://www.whatismyip.com/ and determine my ip address on the
host machine I am running tomcat.
Step 2) Go to my domains at http://godaddy.com , log in, click on my
account, expand domains, click launch, click manage, click on the (A) host
line and change the ip address to the value found in step 1.
Step 3) Repeat step 2 for the second website.  (Wait an hour for the name
servers to pick up the new ip address)
Step 4) Open the servers.xml in the conf folder of the tomcat install.
Find and replace 8080 with 80 and 8443 with 443.
Step 5) Go to my router and verify that port 80 and port 443 are being
hosted by the server where tomcat is installed. (router specific)
Step 6) Go to the control panel, system and security, allow a program
through windows firewall, browse to the tomcat service runner. Verify that
commons daemon service runner is in my windows program firewall exception
list.  (Both public and private checked)
Step 7) Modify tomcat-users.xml in the conf folder.   Uncomment the
security lines. Add
             <role rolename="manager-gui"/>
             <role rolename="manager"/>
             <user username="something" password="somethingsecret"
roles="manager-gui,manager"/>
Step 8) Start up tomcat at the windows command line run as administrator.
In the bin directory run startup.bat
Step 9) Verify that I get the tomcat installation page when I go to either
website.  (YES)
Step 9) Shut down tomcat by running shutdown.bat in the bin directory of
the tomcat installation
Step 10) Add the following lines in the server.xml right after localhost

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

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

</Host>

<Host name="websiteb.org"  appBase="websiteb"
                        unpackWARs="true" autoDeploy="true"
                        xmlValidation="false" xmlNamespaceAware="false">
</Host>
Step 11) Create directories websitea and websiteb in the same directory as
tomcat webapps.
Step 12) Create a ROOT.war file in eclipse by creating a dynamic website
project.  Drop html file in the WebContent folder of the site named
index.html.  Then right click on the project in eclipse, select Export
select WAR file.   Save as ROOT.war file at tomcat directory websitea
Step 13) Create a ROOT.war file in eclipse for the second site with a
different index.html the same way.  Save as ROOT.war at tomcat directory
websiteb.
Step 14) remove the ROOT folder in webapps.   Put websitea.com ROOT.war
file in webapps.   (Experimenting here...)
Step 14) Startup Tomcat by running startup.bat.

Here is the strange behavior that has me puzzled.

When I enter www.websitea.com or www.websiteb.org in the browser it takes
me to the site ROOT.war in webapps

When I enter exactly websitea.com or websiteb.org it takes me to the
"correct"  website.

Why does the www make a difference?

Maybe put an alias in the host entry?



On Fri, Apr 6, 2012 at 1:05 PM, Jeffrey Lilly <jslilly@hebr...>wrote:

>  As with Kerry, I have also done it as the blog says. More information
> would be helpful.
>
> Ultimately, I went with Apache and the Tomcat/JK connector. This allowed
> us to not only host multiple domains with a single Tomcat instance, but
> also allows us to easily integrate other server-side architecture such as
> Python, PHP, etc. (Yes...some of these could be substituted within the JVM,
> but we chose not to for a number of reasons 5+ years ago)
>
>
>
>
> On 4/5/12 8:51 PM, Kerry Wilson wrote:
>
> I have done that before exactly as the blog says.  What is the behavior
> you are seeing? Perhaps you could let apache handle the virtual hosting and
> run two tomcat instances.
>
>
> Sent from Phonezilla, my Samsung Galaxy Note
>
>
> -------- Original message --------
> Subject: [ajug-members] Running multiple sites off of a single tomcat
> server
> From: Bryan Pauquette <bryan.pauquette@gmai...><bryan.pauquette@gmai...>
> To: ajug-members@ajug...
> CC: [ajug-members] Running multiple sites off of a single tomcat server
>
>
>   Hey has anyone been able to run multiple sites (domains) off a single
>    tomcat server?
>
>
>    I found some somewhat useful links and I have been experimenting with
> them
>    but the behavior I am experiencing does not match what I expect.
>
>     http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html
>
>
> http://iam-rakesh.blogspot.com/2009/10/hosting-multiple-domains-in-tomcat.html
>
>
>  I am running tomcat 6.0.35.   So far I have updated server.xml and
> defined
>    two host entries and put a ROOT.war
>    at the location I defined in appbase
>    appBase="atlantaapps"
>
> Anyone do this before?
>
>  I have been wasting my time on this rabbit-hole.....
>
>
>
> _______________________________________________
> ajug-members mailing listajug-members@ajug.orghttp://www.ajug.org/mailman/listinfo/ajug-members
>
>
>
> _______________________________________________
> ajug-members mailing list
> ajug-members@ajug...
> http://www.ajug.org/mailman/listinfo/ajug-members
>
>

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.