Tomcat domain name configuration

Open server.xml under tomhome/conf/ and

add the following:

<Host appBase="C:/aaaa" autoDeploy="true" debug="0" deployXML="true" liveDeploy="true" name=" www.xxxxxxxx .com " unpackWARs="true">
<Context cachingAllowed="true" cookies="true" crossContext="true" debug="0" docBase="C:/aaa/bbb" path="" privileged="false" reloadable="true" swallowOutput="false" useNaming="true" >
</Context>
</Host>
This is not enough, after configuration, now enter http://localhost:8080/ and your IP: 8080 is No problem, but you must configure your hosts file in order to access it from the external network.

The windows server is at: C:






# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#     102.54.94.97   rhino.acme.com       # source server
#     38.25.63.10   x.acme.com         # x client host

127.0.0.1     localhost
*.*.*.*       www.***.com



linux服务器在/etc/下,命令行下:vi hosts

Example: # Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost lkpor1
*.*.*.* www.***.com



If the domain name is configured under Tomcat ( Such as: www.***.com), and do not want customers to access Tomcat's default ROOT through the IP or domain name of our website, the preparation method is as follows:
1. Open \conf\server.xml in the Tomcat installation directory File
2. In server.xml, change the original <Host name="localhost" appBase="webapps" ......> to <Host name="the domain name you want to configure" appBase="webapps" ......>
3. Create a directory "<the name of the domain name you want to configure>" in the \conf\Catalina directory, and then create a ROOT.xml file whose format is the same as ROOT.xml in the \conf\localhost directory, but the content is as follows:
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="Welcome to 56World!" docBase="D:\workplace\inbuilding" path="">
</Context>
The content in docBase is the directory you want to map to when you open your domain name (www.***.com) and the default web page (eg index.jsp)
4. Start the Tomcat server, you can directly type in the domain name to access the address you want to access.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326802508&siteId=291194637