Tomcat multi-domain configuration and Tomcat Domain Configuration

Source: Internet
Author: User

Tomcat multi-domain configuration and Tomcat Domain Configuration
Environment

  • One tomcat, multiple projects are deployed below

  • There is an independent IP Address

  • Multiple top-level (second-level) domain names direct to different projects.

DNS Configuration

DNS has no special requirements. You only need to point all configurations to this IP address.

Tomcat configuration

There may be multiple configuration methods for multiple domain names. I use a method (file structure) that looks troublesome.

ConnectorThe configuration methods are basically the same:

<Connector port="80" protocol="HTTP/1.1"           URIEncoding="UTF-8"           connectionTimeout="20000"           redirectPort="8443" />

First, all ports are 80. GenerallyURIEncoding="UTF-8"Prevent garbled characters.

The following describes how to configure multiple domain names:

<Engine name="Catalina" defaultHost="www.mybatis.tk">  <Host name="www.mybatis.tk"  appBase="webapps"        unpackWARs="true" autoDeploy="true">  </Host>  <Host name="www.cndocs.tk"  appBase="docapps"        unpackWARs="true" autoDeploy="true">  </Host>  <Host name="mbg.cndocs.tk"  appBase="mbg"        unpackWARs="true" autoDeploy="true">  </Host>  <Host name="spring.cndocs.tk"  appBase="spring"        unpackWARs="true" autoDeploy="true">  </Host></Engine>

First look atdefaultHost="www.mybatis.tk"This configuration means that the domain name host (HostOfname).

The following top-level (and second-level) domain name configurations are the same:

<Host name="www.mybatis.tk"    appBase="webapps" unpackWARs="true" autoDeploy="true"></Host>

Note thatappBaseIn the tomcat directory.webappsDirectory. By defaultROOT. So this configuration is actually equivalentwebapps/ROOT.

The other items in the complete configuration abovedocapps,mbg,springIt is also directly in the tomcat directory (andwebappsIs a level directory), all haveROOTDirectory, the deployed projects are also directly inROOT.

After the above configuration, you can access it normally.

The website configured above is the following website Region

Welcome to MyBatis tool: www. mybatis. tk Chinese document directory: www. cndocs. tkSpring4 Chinese document: spring. cndocs. tkMyBatis Generator Chinese document: mbg. cndocs. tk

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.