{"id":293,"date":"2012-11-22T17:44:13","date_gmt":"2012-11-22T12:14:13","guid":{"rendered":"http:\/\/askadmin.com\/?p=293"},"modified":"2012-11-22T17:44:13","modified_gmt":"2012-11-22T12:14:13","slug":"tomcat-virtual-hosts-and-access-logging","status":"publish","type":"post","link":"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/","title":{"rendered":"Tomcat -Virtual hosts and Access logging"},"content":{"rendered":"<p>Some times we may need to run\u00a0multiple\u00a0websites on single ip address with the same port number ,for example http( tcp-80 ) port .<\/p>\n<p>If I have 2 websites called \u00a0www.example1.com and \u00a0www.example2.com pointing to same webserver 10.0.0.10, \u00a0then i will configure my tomcat webserver( 10.0.0.10 )following way .<\/p>\n<p>&nbsp;<\/p>\n<p>Using vim editor i will \u00a0edit \/tomcat_directory\/conf\/server.xml and add seperate \u00a0virtual host entries for each domain .<\/p>\n<p>&nbsp;<\/p>\n<p><strong><em>&lt;Host name=&#8221;www.example1.com&#8221; debug=&#8221;0&#8243; appBase=&#8221;example1&#8243;<\/em><\/strong><br \/>\n<strong><em> unpackWARs=&#8221;true&#8221; autoDeploy=&#8221;true&#8221;<\/em><\/strong><br \/>\n<strong><em> xmlValidation=&#8221;false&#8221; xmlNamespaceAware=&#8221;false&#8221;&gt;<\/em><\/strong><br \/>\n<strong><em>&lt;Context path=&#8221;&#8221; docBase=&#8221;.&#8221;\/&gt;<\/em><\/strong><br \/>\n<strong><em> &lt;Logger className=&#8221;org.apache.catalina.logger.FileLogger&#8221;<\/em><\/strong><br \/>\n<strong><em> directory=&#8221;logs&#8221; prefix=&#8221;localhost_log.&#8221; suffix=&#8221;.txt&#8221;<\/em><\/strong><br \/>\n<strong><em> timestamp=&#8221;true&#8221;\/&gt;<\/em><\/strong><br \/>\n<strong><em>&lt;Valve className=&#8221;org.apache.catalina.valves.AccessLogValve&#8221; directory=&#8221;logs&#8221;<\/em><\/strong><\/p>\n<p><strong><em>prefix=&#8221;localhost_access_log.&#8221; suffix=&#8221;.txt&#8221; pattern=&#8221;common&#8221; resolveHosts=&#8221;false&#8221;\/&gt;<\/em><\/strong><\/p>\n<p><strong><em> &lt;Host name=&#8221;www.example2.com&#8221; debug=&#8221;0&#8243; appBase=&#8221;example2&#8243;<\/em><\/strong><br \/>\n<strong><em> unpackWARs=&#8221;true&#8221; autoDeploy=&#8221;true&#8221;<\/em><\/strong><br \/>\n<strong><em> xmlValidation=&#8221;false&#8221; xmlNamespaceAware=&#8221;false&#8221;&gt;<\/em><\/strong><br \/>\n<strong><em>&lt;Context path=&#8221;&#8221; docBase=&#8221;.&#8221;\/&gt;<\/em><\/strong><br \/>\n<strong><em> &lt;Logger className=&#8221;org.apache.catalina.logger.FileLogger&#8221;<\/em><\/strong><br \/>\n<strong><em> directory=&#8221;logs&#8221; prefix=&#8221;localhost_log.&#8221; suffix=&#8221;.txt&#8221;<\/em><\/strong><br \/>\n<strong><em> timestamp=&#8221;true&#8221;\/&gt;<\/em><\/strong><br \/>\n<strong><em>&lt;Valve className=&#8221;org.apache.catalina.valves.AccessLogValve&#8221; directory=&#8221;logs&#8221;<\/em><\/strong><\/p>\n<p><strong>prefix=&#8221;localhost_access_log.&#8221; suffix=&#8221;.txt&#8221; pattern=&#8221;common&#8221; resolveHosts=&#8221;false&#8221;\/&gt;<\/strong><\/p>\n<p><strong><em>&lt;\/Host&gt;<\/em><\/strong><\/p>\n<p><strong><em>&lt;\/Engine&gt;<\/em><\/strong><\/p>\n<p><strong><em>&lt;\/Service&gt;<\/em><\/strong><\/p>\n<p><strong><em>&lt;\/Server&gt;<\/em><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>example1 and example2 \u00a0are root directories \u00a0where we \u00a0can copy webpages .<\/p>\n<p><strong><em>&lt;Valve className=&#8221;org.apache.catalina.valves.AccessLogValve&#8221; directory=&#8221;logs&#8221;<\/em><\/strong><\/p>\n<p><strong><em>prefix=&#8221;localhost_access_log.&#8221; suffix=&#8221;.txt&#8221; pattern=&#8221;common&#8221; resolveHosts=&#8221;false&#8221;\/&gt;<\/em><\/strong> \u00a0&#8230;&#8230;. this entry will log \u00a0website access logs \u00a0in \/tomcat_directory\/logs .<\/p>\n<p><a href=\"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/tomcat\/\" rel=\"attachment wp-att-294\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-294\" title=\"tomcat\" src=\"https:\/\/askadmin.com\/aa\/aa\/wp-content\/uploads\/2012\/11\/tomcat.jpg\" alt=\"\" width=\"893\" height=\"437\" srcset=\"https:\/\/askadmin.com\/aa\/wp-content\/uploads\/2012\/11\/tomcat.jpg 893w, https:\/\/askadmin.com\/aa\/wp-content\/uploads\/2012\/11\/tomcat-500x244.jpg 500w\" sizes=\"(max-width: 893px) 100vw, 893px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some times we may need to run\u00a0multiple\u00a0websites on single ip address with the same port number ,for example http( tcp-80 ) port . If I have 2 websites called \u00a0www.example1.com and \u00a0www.example2.com pointing to same webserver 10.0.0.10, \u00a0then i will configure my tomcat webserver( 10.0.0.10 )following way . &nbsp; Using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[7,4],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Tomcat -Virtual hosts and Access logging  - Ask Admin - A Lifelong Learner<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tomcat -Virtual hosts and Access logging  - Ask Admin - A Lifelong Learner\" \/>\n<meta property=\"og:description\" content=\"Some times we may need to run\u00a0multiple\u00a0websites on single ip address with the same port number ,for example http( tcp-80 ) port . If I have 2 websites called \u00a0www.example1.com and \u00a0www.example2.com pointing to same webserver 10.0.0.10, \u00a0then i will configure my tomcat webserver( 10.0.0.10 )following way . &nbsp; Using [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/\" \/>\n<meta property=\"og:site_name\" content=\"Ask Admin - A Lifelong Learner\" \/>\n<meta property=\"article:published_time\" content=\"2012-11-22T12:14:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/askadmin.com\/aa\/aa\/wp-content\/uploads\/2012\/11\/tomcat.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"balu sreekanth\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/askadmin.com\/aa\/#website\",\"url\":\"https:\/\/askadmin.com\/aa\/\",\"name\":\"Ask Admin - A Lifelong Learner\",\"description\":\"Mobile App Development | IP Telephony | Linux\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/askadmin.com\/aa\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/askadmin.com\/aa\/aa\/wp-content\/uploads\/2012\/11\/tomcat.jpg\",\"contentUrl\":\"https:\/\/askadmin.com\/aa\/aa\/wp-content\/uploads\/2012\/11\/tomcat.jpg\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/#webpage\",\"url\":\"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/\",\"name\":\"Tomcat -Virtual hosts and Access logging - Ask Admin - A Lifelong Learner\",\"isPartOf\":{\"@id\":\"https:\/\/askadmin.com\/aa\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/#primaryimage\"},\"datePublished\":\"2012-11-22T12:14:13+00:00\",\"dateModified\":\"2012-11-22T12:14:13+00:00\",\"author\":{\"@id\":\"https:\/\/askadmin.com\/aa\/#\/schema\/person\/e1ff95d4a91ea001e25af3273533a345\"},\"breadcrumb\":{\"@id\":\"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/askadmin.com\/aa\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tomcat -Virtual hosts and Access logging\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/askadmin.com\/aa\/#\/schema\/person\/e1ff95d4a91ea001e25af3273533a345\",\"name\":\"balu sreekanth\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/askadmin.com\/aa\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6aebf95935573dc70f536f1003a2fb8c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6aebf95935573dc70f536f1003a2fb8c?s=96&d=mm&r=g\",\"caption\":\"balu sreekanth\"},\"sameAs\":[\"http:\/\/askadmin.com\"],\"url\":\"https:\/\/askadmin.com\/aa\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tomcat -Virtual hosts and Access logging  - Ask Admin - A Lifelong Learner","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/","og_locale":"en_US","og_type":"article","og_title":"Tomcat -Virtual hosts and Access logging  - Ask Admin - A Lifelong Learner","og_description":"Some times we may need to run\u00a0multiple\u00a0websites on single ip address with the same port number ,for example http( tcp-80 ) port . If I have 2 websites called \u00a0www.example1.com and \u00a0www.example2.com pointing to same webserver 10.0.0.10, \u00a0then i will configure my tomcat webserver( 10.0.0.10 )following way . &nbsp; Using [&hellip;]","og_url":"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/","og_site_name":"Ask Admin - A Lifelong Learner","article_published_time":"2012-11-22T12:14:13+00:00","og_image":[{"url":"https:\/\/askadmin.com\/aa\/aa\/wp-content\/uploads\/2012\/11\/tomcat.jpg"}],"twitter_misc":{"Written by":"balu sreekanth","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/askadmin.com\/aa\/#website","url":"https:\/\/askadmin.com\/aa\/","name":"Ask Admin - A Lifelong Learner","description":"Mobile App Development | IP Telephony | Linux","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/askadmin.com\/aa\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/#primaryimage","inLanguage":"en-US","url":"https:\/\/askadmin.com\/aa\/aa\/wp-content\/uploads\/2012\/11\/tomcat.jpg","contentUrl":"https:\/\/askadmin.com\/aa\/aa\/wp-content\/uploads\/2012\/11\/tomcat.jpg"},{"@type":"WebPage","@id":"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/#webpage","url":"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/","name":"Tomcat -Virtual hosts and Access logging - Ask Admin - A Lifelong Learner","isPartOf":{"@id":"https:\/\/askadmin.com\/aa\/#website"},"primaryImageOfPage":{"@id":"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/#primaryimage"},"datePublished":"2012-11-22T12:14:13+00:00","dateModified":"2012-11-22T12:14:13+00:00","author":{"@id":"https:\/\/askadmin.com\/aa\/#\/schema\/person\/e1ff95d4a91ea001e25af3273533a345"},"breadcrumb":{"@id":"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/askadmin.com\/aa\/tomcat-virtual-hosts-and-access-logging\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/askadmin.com\/aa\/"},{"@type":"ListItem","position":2,"name":"Tomcat -Virtual hosts and Access logging"}]},{"@type":"Person","@id":"https:\/\/askadmin.com\/aa\/#\/schema\/person\/e1ff95d4a91ea001e25af3273533a345","name":"balu sreekanth","image":{"@type":"ImageObject","@id":"https:\/\/askadmin.com\/aa\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/6aebf95935573dc70f536f1003a2fb8c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6aebf95935573dc70f536f1003a2fb8c?s=96&d=mm&r=g","caption":"balu sreekanth"},"sameAs":["http:\/\/askadmin.com"],"url":"https:\/\/askadmin.com\/aa\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/askadmin.com\/aa\/wp-json\/wp\/v2\/posts\/293"}],"collection":[{"href":"https:\/\/askadmin.com\/aa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/askadmin.com\/aa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/askadmin.com\/aa\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/askadmin.com\/aa\/wp-json\/wp\/v2\/comments?post=293"}],"version-history":[{"count":3,"href":"https:\/\/askadmin.com\/aa\/wp-json\/wp\/v2\/posts\/293\/revisions"}],"predecessor-version":[{"id":297,"href":"https:\/\/askadmin.com\/aa\/wp-json\/wp\/v2\/posts\/293\/revisions\/297"}],"wp:attachment":[{"href":"https:\/\/askadmin.com\/aa\/wp-json\/wp\/v2\/media?parent=293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/askadmin.com\/aa\/wp-json\/wp\/v2\/categories?post=293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/askadmin.com\/aa\/wp-json\/wp\/v2\/tags?post=293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}