修改TOMCAT默认端口web
1改端口8080为80apache
80端口是http协议的默认端口,8080端口同80端口,也是被用于WWW代理服务实现网页浏览tomcat
在tomcat安装目录下的conf子目录下,找到server.xml文件,查找到以下信息网络
Connector port="8080" 将8080改成80便可,省去了输写网址的时候加端口:8080app
如无效说明80端口被其余程序占用了,解决方法:webapp
找到netstat.exe(很好用的网络监测工具)所在C:\WINDOWS\system32,DOS下输入netstat -ano,工具
显示全部端口和PID地址,打开任务管理器,查看-选择列,勾选PID,将80端口号对应的PID程序结束。spa
搞定,能够打开省去端口号的网址了。debug
2若使用了两个tomcat,那么就须要修改其中的一个的端口号才能使得两个同时工做.代理
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />将port="8080"改成其它的如8088就能够了。这种修改对于8080端口冲突是能够解决的,可是若是想同时使用两个tomcat,则不完整,由于还有其它的端口会冲突。咱们仍须要继续修改
将<Server port="8005" shutdown="SHUTDOWN" debug="0">的8005改成其它。
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />的8009改成其它。
整合apache用的是8009端口,8005口看标签是用于向tomcat发布shutdown命令的
通过以上3个修改,应该能够了。(若是还不行,那么就看一些错误提示吧,应该会说在那个端口有冲突的,到时再根据须要改动便可)。
Tomcat域名配置
在Tomcat/confi/Server.xml下配置以下:
<Host name="www.chenwei.com" appBase="webapps"
unpackWARs="true"
xmlValidation="false" xmlNamespaceAware="false"> (下步才是重点)
在本地電腦C:\WINNT\system32\drivers\etc\Hosts配置了該域名﹐以下﹕
# 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
*.*.*.*(表示个人IP) www.chenwei.com (只有最后一行添加上去)