水泥砂浆找平层 压光:tomcat部署多个项目,通过域名解析访问,不同的网站

来源:百度文库 编辑:中财网 时间:2024/04/28 15:35:26

说明:

1.首先需要有多个域名,同时指向一个IP地址。

例如:域名:www.bbb.com, www.aaa.com等等。

           解析到一个公网IP地址:210.34.120.110.

2.需要对tomcat下的conf下的"server.xml"进行配置

   
   
   

   
                      type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />

   
                     connectionTimeout="20000"
               redirectPort="8443" URIEncoding="gbk" />
      

   
   

      
                   resourceName="UserDatabase"/>

      
                  unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

      
     
                unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      

   

                 unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      

   


这样,就可以访问多个项目,通过不同的域名进行。

附:如果进行本地测试。则需加如下配置:

C:\Windows\System32\drivers\etc\hosts(Vista系统下路径,其他操作系统可能不一样)

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# 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     www.aaa.com

127.0.0.1     www.bbb.com

127.0.0.1     localhost