前提准备:
linux云服务器, tomcat ,域名(已解析),项目war包
1、修改端口为80端口
因为80端口是为HTTP(HyperText Transport Protocol)即超文本传输协议开放的,浏览网页服务默认的端口号都是80,因此只需输入网址(或IP地址)即可。
打开tomcat安装目录,根据路径找到 server.xml 路径......\apache-tomcat-7.0.70\conf\server.xml 如下:将其中port="8080"修改为port="80"即可。
<Connector port="80" useBodyEncodingForURI="true" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
2、修改域名
找到如下字段:将localhost修改为自己自定域名
<Host name="www.5156ol.com" appBase="webapps"
unpackWARs="true" autoDeploy="true">
3、去掉项目名称
在第二部内容中继续添加如下内容,意思就是将webapps下的shsxtnote项目 /shsxtnote路径改为/ 访问,去掉项目名称。
<Context path="" docBase="/shsxtnote" debug="0" reloadable="true"></Context>
是修改后的效果:
1 2 3 4 |
|
docBase这个量,它指定的是登录tomcat默认的主页所在的文件夹,这个量默认情况下指定的是ROOT文件夹。
4.修改tomcat访问默认首页
conf/web.xml中。默认配置如下
- <span style="font-family:SimSun;"><span style="font-size:14px;"> <welcome-file-list>
- <welcome-file>index.html</welcome-file>
- <welcome-file>index.htm</welcome-file>
- <welcome-file>index.jsp</welcome-file>
- </welcome-file-list></span></span>
如在此项目(shsxtnote)中默认的的首页也名为index.xxx话,可不作设置