netstat - ano查看端口占用情况
Web应用供外界访问方法
1.放在tomcat的webapp文件夹中。
2.虚拟映像
tomcat提供5种方法。
http://localhost:8080/docs/config/context.html
Context elements may be explicitly defined:
- In the
$CATALINA_BASE/conf/context.xmlfile: the Context element information will be loaded by all webapps. - In the
$CATALINA_BASE/conf/[enginename]/[hostname]/context.xml.defaultfile: the Context element information will be loaded by all webapps of that host. - In individual files (with a ".xml" extension) in the
$CATALINA_BASE/conf/[enginename]/[hostname]/directory. The name of the file (less the .xml extension) will be used as the context path. Multi-level context paths may be defined using #, e.g.foo#bar.xmlfor a context path of/foo/bar. The default web application may be defined by using a file calledROOT.xml. - Only if a context file does not exist for the application in the
$CATALINA_BASE/conf/[enginename]/[hostname]/, in an individual file at/META-INF/context.xmlinside the application files. If the web application is packaged as a WAR then/META-INF/context.xmlwill be copied to$CATALINA_BASE/conf/[enginename]/[hostname]/and renamed to match the application's context path. Once this file exists, it will not be replaced if a new WAR with a newer/META-INF/context.xmlis placed in the host's appBase. - Inside a Host element in the main
conf/server.xml.
使用第四种
若Tomcat 和Web应用不在同一个盘中,可在 tomcat的conf/Catalina/localhost目录中加一个XML文件,文件名为虚拟映像名,如zpy.xml,内容为<Context docBase="F:\web文件名"/>,服务器会自动加载该应用。
在项目的Web-inf目录中可配置首页,输入项目名即可访问(http://localhost:8080/Test/)
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
reloadable 设置为true.改过之后 不需要重新发布,服务器会自动 更新。在实际开发中最好不要配制,因为一但改动就会重新加载,应用较大时一旦连续加载会挂掉。
本文介绍了如何在Tomcat服务器中部署Web应用,包括通过放置在webapps文件夹、使用虚拟主机映射以及通过配置context.xml文件的方式。此外还讲解了如何设置应用的默认首页及配置热更新。
1159

被折叠的 条评论
为什么被折叠?



