Tomcat one IP binds multiple domain names, different domains access different applications

Source: Internet
Author: User

Modify the contents of the Server.xml engine under the Conf folder to
The original content is as follows:

...<Enginename= "Catalina"Defaulthost= "localhost">      <RealmClassName= "Org.apache.catalina.realm.UserDatabaseRealm"resourcename= "Userdatabase"/>      <Hostname= "localhost"AppBase= "WebApps"Unpackwars= "true"xmlvalidation= "false"Xmlnamespaceaware= "false">      </Host> </Engine>...

Assume

(1) You have only one IP address: 125.125.125.125

(2) then made three websites: Baidu, Google, admin backstage

(3) applied for two domain name www.baidu.com www.google.com www.system.com

(4) Requirements: With different domain names, IP addresses can access different websites

Then you can do it.

The first step: Modify the Conf folder below the Server.xml, the modified content is as follows

...<Enginename= "Catalina"Defaulthost=www.baidu.com><realm ClassName= "Org.apache.catalina.realm.UserDatabaseRealm"resourcename= "Userdatabase"/>         <Hostname= "Www.baidu.com"AppBase= "Baidu_apps"Unpackwars= "true"xmlvalidation= "false"Xmlnamespaceaware= "false"/>         <Hostname= "www.google.com"AppBase= "Google_apps"Unpackwars= "true"xmlvalidation= "false"Xmlnamespaceaware= "false"/>         <Hostname= "www." system. com "AppBase= "System_apps"Unpackwars= "true"xmlvalidation= "false"Xmlnamespaceaware= "false"/>    </Engine>...

Step two: Below the Tomcat root directory
Baidu_apps\root to place your Baidu website
Google_apps\root to place your Google site
System_apps\root to place your admin background

Step three: Resolve the domain A record to IP125.125.125.125.

If you want baidu.com to also have access to the app, add a host record and baidu.com resolution A to IP125.125.125.125.

<name= "baidu.com"  appBase= "Baidu_apps"  unpackwars = "true" xmlvalidation = "false" Xmlnamespaceaware = "false" />

Tomcat one IP binds multiple domain names, different domains access different applications

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.