Production Server setup for multiple web application

Hello there,

I have a dedicated server with server 2008 R2 installed on it. The server has a static IP and I want to setup two web application on this server with different sub-domains but pointing to one static IP (31.223.212.122).
I am using Tomcat for this setup. Can somebody please suggest if this is the right way to go ahead or it is not good for production environment. My application are Java platform.

so my domains are abc.domain.com and xyz.domain2.com and I have pointed both to the same IP 31.223.212.122.

Please help me to setup my environment.

cheers
Zolf
zolfAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
in your public DNS set the ip address to 31.223.212.122
on the router port forward http port 80 tcp traffic to the local ip address of the server
modify your server.xml
<server port="8005" shutdown="SHUTDOWN">  
  <service name="Catalina">  
      <engine defaulthost="localhost" name="Catalina">  
         <host appbase="webapps" autodeploy="true" name="localhost" unpackwars="true"></host>  
         <host appbase="domain1_webapps" autodeploy="true" name="abc.domain1.com" unpackwars="true"></host>  
         <host appbase="domain2_webapps" autodeploy="true" name="def.domain2.com" unpackwars="true"></host>  
</host>  
</engine>  
</service>  
</server>  

Open in new window

http://www.ramkitech.com/2012/02/understanding-virtual-host-concept-in.html
0
zolfAuthor Commented:
thanks for your comments. DO I also need Apache server or Tomcat alone will do. I have been reading some post where they suggest to have Apache Server and Tomcat together.Please comment on this.
0
David Johnson, CD, MVPOwnerCommented:
I don't use either but tomcat can run standalone
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

zolfAuthor Commented:
in your public DNS set the ip address to 31.223.212.122
on the router port forward http port 80 tcp traffic to the local ip address of the server

I dont have access to the router. I mean I have rented a dedicated server from a Data Center provider. Do I need to do this as well.
0
David Johnson, CD, MVPOwnerCommented:
then you have to in the management portal open the endpoint for port 80 from all
0
zolfAuthor Commented:
Thanks!!
Now when I enter the static IP with the port number 8080 like so  31.223.212.122:8080 in a browser it shows me the tomcat manager page. But when i change the port to 80 in the server.xml, then it is not working. what am i doing wrong.
0
zolfAuthor Commented:
I have made changes to my server.xml file like so

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

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
      </Host>
			   
	  <Host name="kaizen.domain1.com" appbase="domain1_webapps" unpackwars="true" autodeploy="true"/> 
      
	  <Host name="kaizen.domain2.com" appbase="domain2_webapps"  unpackwars="true" autodeploy="true"/>

Open in new window


then i created 2 folders in C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0

domain1_webapps
domain2_webapps

Now I copied my root.war in those folders and restarted Tomcat but Tomcat did not create the ROOT folder from that root.war. WHY??....what am i missing.

please help!!

cheers
Zolf
0
zolfAuthor Commented:
somebody there to help me achieve my goal!!
0
David Johnson, CD, MVPOwnerCommented:
did you follow something like http://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html to install tomcat ?
0
zolfAuthor Commented:
Thanks for your comments. I dont have issue with my Tomcat. As I mentioned,when I enter the IP address of the server I get to see the Tomcat manager page. Please see my 2 above comments.
0
zolfAuthor Commented:
someone please help
0
zolfAuthor Commented:
I get this warning in my apache log file

2015-08-01 11:10:39 Commons Daemon procrun stderr initialized
Aug 01, 2015 11:10:40 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'appbase' to 'domain1_webapps' did not find a matching property.
Aug 01, 2015 11:10:40 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'unpackwars' to 'true' did not find a matching property.
Aug 01, 2015 11:10:40 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'autodeploy' to 'true' did not find a matching property.
Aug 01, 2015 11:10:40 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'appbase' to 'domain2_webapps' did not find a matching property.
Aug 01, 2015 11:10:40 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'unpackwars' to 'true' did not find a matching property.
Aug 01, 2015 11:10:40 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'autodeploy' to 'true' did not find a matching property.

Open in new window

0
David Johnson, CD, MVPOwnerCommented:
First mistake
C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0
take the zip file and extract it to a folder i..e
tomcat locationc:\program files is a protected area and you have a 64 bit operating system you should be using the x64 executables for tomcat, jdk, jre
did you add JAVA_HOME to your environment variables
did you do a mklink /D tomcat c:\apache-tomcat-8.0.24  <Elevated command prompt needed>
      

From the beginning you have single "Host" record in your conf/server.xml for localhost

<Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">
      <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
</Host>

Now you can add another "Host" records, for example

  <Host name=domain1.com"  appBase="anotherclient" domain1_webapps="true" autoDeploy="true">

       <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="domain1_webappst_access_log." suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />
  </Host>

You also have to create a "META-INF" folder case-sensitive in that webapp directory

http://bit.ly/1IbGRky
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zolfAuthor Commented:
Thanks for your feedbacks. Appreciate it!!

You also have to create a "META-INF" folder case-sensitive in that webapp directory

Do i need to create this folder for each appBase??
Does anything go into this folder or it should be empty?
Why do we need this folder for?
0
David Johnson, CD, MVPOwnerCommented:
Yes for each app this is where the .jar gets unpacked. just make an empty folder an let tomcat manage it.
0
zolfAuthor Commented:
Got it working. Thanks a lot!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.