Tomcat Domain-based virtual host and access logs

Source: Internet
Author: User

By default, the Tomcat application directory is the WebApps directory under the Tomcat base directory, the http://ip/project name is required to access the project after accessing the WebApps directory, and if you want to configure Server.xml directly, modify


Create multiple virtual hosts from a domain name


Dation= "false" >
<context docbase= "/data/zdz1/" path= "" reloadable= "false"/>
</Host>
Ation= "false" >
<context docbase= "/data/zdz2/" path= "" reloadable= "false"/>
</Host>

By default, Tomcat defines the access log to Logs/localhost_access_log,


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

You can define access logs in each virtual host, and you can format the log as needed
%{x-forwarded-for}i represents obtaining the client's true IP address, which is used when the Tomcat front-end has a reverse proxy.


N= "false" >
<context docbase= "/data/zdz3/" path= "" reloadable= "false"/>
<valve classname= "Org.apache.catalina.valves.AccessLogValve" directory= "Logs"
Prefix= "Tomcat3.zdz.com_access_log." suffix= ". txt"
pattern= "%{x-forwarded-for}i%a%u%t%r%s%b%{user-agent}i%{referer}i" resolvehosts= "false"/>
</Host>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.