您的位置:首页 > 运维架构 > Tomcat

Tomcat 配置域名

2010-08-27 17:40 295 查看
====>我的新浪小铺

1. 根据以下路径打到 hosts 文件,并修改。

(1)路径: C:\Windows\System32\drivers\etc

(2)hots 文件内容及修改

# Copyright (c) 1993-2009 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

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

在最后新增一行,IP和域名之间以空格隔开:

127.0.0.1 www.top117.com/

2. 修改tomcat 中server.xml文件,两处改动如下:

(1)修改端口,将端口改为80:

<Connector port="80" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100" />

(2)将主机名改为自己的域名,如下:

<Host name="www.top117.com/" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="D:/workspace/top117/WebRoot" path="" reloadable="true"/>
</Host>

docBase="" 指向自己项目的WebRoot目录

3. 在MyEclipse 下启动tomcat, 在IE中输入自己配置的域名访问一下,即可看到自己的项目。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: