Tomcat Multi-domain Configuration

Source: Internet
Author: User

Environment
    • One tomcat, with multiple projects deployed below

    • There is an independent IP

    • There are multiple top level (level two) domain names that point to different projects.

DNS Configuration

DNS has no special requirements, the configuration points to this IP on the line.

Tomcat Configuration

Multiple domain names can be configured in many ways, and I use one (file structure) to look at the more troublesome way.

ConnectorAre configured basically the same way:

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

The first port is 80, generally will also take on to URIEncoding="UTF-8" prevent garbled.

Here's how to configure multiple domains:

<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 at the first line defaultHost="www.mybatis.tk" , this configuration means that when accessed through the IP address, the use of the domain host (and the following specific Host name consistency).

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

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

It is important to note here that the appBase directory under the Tomcat directory is pointed to, by default, to the directory webapps ROOT . So this configuration is actually equivalent webapps/ROOT .

The rest of the above full configuration docapps,mbg,spring is also directly under Tomcat directory (and webapps is a peer directory), there are ROOT directories, deployed projects are also directly ROOT under.

As configured above, it is normal to have access.

The sites configured above are the following URLs ↓

Welcome to MyBatis Tool: www.mybatis.tk Chinese document directory: Www.cndocs.tkSpring4 Chinese document: Spring.cndocs.tkMyBatis generator Chinese Document: mbg.cndocs.tk

Tomcat Multi-domain Configuration

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.