-2

I’m new to Apache Tomcat. I have been asked to point new domain name to the existing domain name. E.g. We have https://xyz.abc.com, we want new domain name http://123.abc.com to point to xyz.abc.com. The Apache Tomcat 7 server is installed Windows 2008 R2 server. We have created the DNS entry for 123.abc.com Can someone tell me how to do this? Do I need to create a virtual host and if so how. How do I restart tomcat server on windows 2008 R2?

I read that if I modify server.xml then I need to restart Tomcat. How do I restart Tomcat?

I have a following entry in config/server.xml file:

<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>

Will this work. I want 123.abc.com to go to xyz.abc.com. So 123.abc.com is an alias for xyz.abc.com. Both the sites are pointing to the same appbase.

<Host name="www.knowledgefolders.com" 
  appBase="D:/webpage_demos/akc"
  unpackWARs="true" 
  autoDeploy="true" 
  xmlValidation="false" 
  xmlNamespaceAware="false">

   <Alias>knowledgefolders.com</Alias>

   <Alias>www.knowledgefolders.net</Alias>
   <Alias>knowledgefolders.net</Alias>

   <Alias>www.knowledgefolders.org</Alias>
   <Alias>knowledgefolders.org</Alias>

   <Alias>www.satyakomatineni.com</Alias>
   <Alias>www.kavithakomatineni.com</Alias>

   <Context path="" docBase="D:/webpage_demos/akc" 
       debug="0" reloadable="false"/>
   <Context path="/akc" docBase="D:/webpage_demos/akc" 
      debug="0" reloadable="false"/>
</Host>

Notice how all of the following host names point to the same web app, akc (which was the previous name for Knowledge Folders).

knowledgefolders.com
www.knowledgefolders.com
knowledgefolders.net
www.knowledgefolders.net
knowledgefolders.org
www.knowledgefolders.org
www.satyakomatineni.com
www.kavithakomatineni.com
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972

1 Answers1

0

You want to add a new valve for the rewrite engine. It's almost the same as for Apache's httpd server's mod_rewrite. Alternatively you could install Apache/Nginx HTTP and redirect on it.

TheFiddlerWins
  • 2,999
  • 1
  • 15
  • 22
  • I'm very new with no experience with Tomcat. Can you explain. It's a production server so I do not wish the install another web server. I don't understand what the valve is. – joegreen690 Jul 10 '15 at 23:00
  • You should create a test box to practice/test then, not make untested changes on a production box Running tomcat behind httpd/nginx is quite common. What are you familiar with? – TheFiddlerWins Jul 12 '15 at 01:24
  • I know IIS. So you are saying creating alias like above won't work? I thought if I add line similiar to this www.knowledgefolders.net inside my host tag it should work. – joegreen690 Jul 12 '15 at 18:33