Tuesday, September 23, 2014

Domain mapping for apache-tomcat-7.0.54 using virtual host

1) Add below host to your server.xml file
    for me it was on /usr/local/apache-tomcat-7.0.54/conf/server.xml  path you might find it on location to which you have install your apache-tomcat-7.0.54

<host appbase="/usr/local/apache-tomcat-7.0.54/webapps/health" autodeploy="true" name="yourdomain.com" unpackwars="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>

 2) Add your Domain name in host name field
     2.1 appBase is the path from were this host (a virtual server) is going to look for .war files
     2.2 To have our application accessible by hitting @root of the domain yourdomain.com keep your war file name as "ROOT.war"

 3) So when you start your server this will create a folder with your domain name yourdomain.com in below path

  /usr/local/apache-tomcat-7.0.54/conf/Catalina/yourdomain.com

inside which you will find a ROOT folder which has your application
Happy Coding:)

No comments:

Post a Comment