Detail the configuration of Tomcat multiple domain names
- 2020-06-15 10:46:29
- OfStack
Sometimes we have several projects that need to be published on the same tomcat server, each with a different domain name. This requires configuring multiple domain names and adding multiple virtual hosts in tomcat.
Mainly set in ES5en.xml:
in < Engine > < /Engine > I'm going to add two to it < Host > < /Host > Tag, which reads as follows:
<Host name="www.123.com" appBase="/usr/local/tomcat/webapps/123"
unpackWARs="true" autoDeploy="true">
<Context path="/" docBase="/usr/local/tomcat/webapps/123" debug="0" reloadable="True" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="123_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
<Host name="www.456.com" appBase="/usr/local/tomcat/webapps/456"
unpackWARs="true" autoDeploy="true">
<Context path="/" docBase="/usr/local/tomcat/webapps/456" debug="0" reloadable="True" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="456_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
pattern specifies the format for logging when accessed by the client.
% a - Remote IP address % A - Local IP address % b - Number of bytes sent, not including HTTP header, or "-" if no bytes sent % B - Number of bytes sent, excluding HTTP headers % h - Remote host name H - Request protocol % l (lowercase L)- Remote logic from identd's username (always return '-') % m - Request method % p - Local port % q - Query string (preceded by 1 "?" If it exists, otherwise it is an empty string % r - Requirement for line 1 % s - HTTP status code for response % S - User session ID % t - Date and time in common log format % u - Remote user authentication % U - Requested URL path % v - Local server name % D - Time in milliseconds to process requests % T - Time in seconds to process the request % I (uppercase i) - The thread name of the current requestTomcat memory leak:
JAVA_OPTS='-server -XX:PermSize=64M -XX:MaxPermSize=128m'