tomcat域名解析
Tomcat 域名解析一般項(xiàng)目開發(fā)時(shí)在Tomcat 服務(wù)器中發(fā)布后是通過http://localhost:post/porject來訪問的 而實(shí)際發(fā)布中一般需要通過郁悶來訪問下面就來介紹一下tomc
Tomcat 域名解析
一般項(xiàng)目開發(fā)時(shí)在Tomcat 服務(wù)器中發(fā)布后是通過http://localhost:post/porject來訪問的 而實(shí)際發(fā)布中一般需要通過郁悶來訪問下面就來介紹一下tomcat 域名解析
1、 關(guān)系到域名自然想到host 文件的修改進(jìn)入C:WINDOWSsystem32driversetc找到
host 文件。內(nèi)容為:
# Copyright (c) 1993-1999 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 localhost
修改最后一行 為
127.0.0.1 www.xxx.com.cn (你需要使用的域名)
2、 修改Tomcat 配置
在Tomcat 安裝目錄中找到conf 文件夾下的server.xml 文件,修改兩處
(1)、將端口號修改為80,端口80時(shí)默認(rèn)不顯示
(2)、修改Host 節(jié)點(diǎn) name 屬性為你需要使用的域名,在host 節(jié)點(diǎn)下添加Context 節(jié)
點(diǎn)形式如:
path="" docBase="E:apache-tomcat-6.0.20apache-tomcat-6.0.20wtpwebappswwwroot" debug="0"/> docbase 屬性是你發(fā)布的項(xiàng)目所在tomcat 中的目錄,訪問時(shí)直接過濾掉wwwroot 根節(jié)點(diǎn)。即如上所示wwwroot" 為項(xiàng)目名稱的項(xiàng)目訪問時(shí),將直接從wwwroot 以下的目錄開始訪問 如http://localhost:post/wwwroot 經(jīng)過上面步驟以后將變成