Tomcat configuring domain names and virtual folders

Source: Internet
Author: User

Description:
I add a domain name simulation in this machine, assuming that the host is directly configured to use it. The tomcat I used was apache-tomcat-7.0.42.

Add Domain name locally

This article describes how to change the configuration of Tomcat. Enable direct access to the Tomcat application via IP address or domain name.
First I have 4 domains configured on my own host

Configure the Server.xmlport number

1. Locate the home folder for Tomcat. Go to the Conf folder, locate the Server.xml file, and open:

2. Change Tomcat's monitor port to 80port: Ensure other server 80port is not occupied talent use
Found in Server.xml file:

<Connector port="8080" protocol="HTTP/1.1"               connectionTimeout="20000"               redirectPort="8443" />

Change into:

<Connector port="80" protocol="HTTP/1.1"               connectionTimeout="20000"               redirectPort="8443" />

Configure single work folder single domain name
    1. Found in Server.xml file:
<Host name="localhost"  appBase="webapps"            unpackWARs="true" autoDeploy="true">


4. Replace the localhost in the content found in 3rd with the IP address or domain name you want to change.
In the middle of the label. Add for example the following content:

<Context path="" docBase="/rapidoProject"/>

Description: Host represents a virtual folder. Each virtual folder corresponding to a project, a project can be the corresponding multiple domain names
The Name property of host is found in multiple domain names and can be easily taken, meaning
The value of the docbase can also be an absolute path. I'm using a relative path here, relative to the AppBase WebApps.


Defines a common Web project Rapidoproject, in index.jsp content such as

Start Tomcat

Access to other domain names is invalid. Nothing is going back.

Configure a single working folder multi-domain

Now I use 2 domain names to point to the same project folder, change the host value such as the following

When visiting rapido.com, you will also be interviewed for the Rapidoproject project.

Configure multi-Work folder single/multi-domain

Next, configure multi-project multi-domain names using the same method. Add Host node Configuration



Configure the default Run virtual folder

Engine can configure the default host node

Changed to


Assuming that localhost is not changed by default, add a working folder that preserves the default of localhost by using the domain name change place

Tomcat configuring domain names and virtual folders

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.