一,程序结构
互联网发展到现在出现过两种结构:C / S结构 和 B / S结构
二,web服务器
Web服务器是可以向发出请求的浏览器提供文档的程序,主要提供网上的信息浏览服务
三,访问 Tomcat 服务器
启动停止脚本文件: bin startup.bat
部署应用: webApps
在浏览器地址栏输入网址: http://localhost:8080/firstApp/first.html 进行访问
这个网址有一个专业的名称,叫做 统一资源定位符
统一资源定位符包含了以下三部分:
1.协议 比如 http 主机地址 localhost 127.0.0.1 都是表本机,可以用来代替本机的IP地址
2.主机地址包括了主机 IP 地址和端口号,比如 IP 地址 localhost ,端口号 8080
3.资源地址 比如 /firstApp/first.html
四,配置操作
1.端口号配置
conf sever.xml <Connector port="9000" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
/>
2.虚拟路径配置
conf sever.xml <Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
添加<Context path="/virtual" docBase="D:\01\01frontend\javaWeb基础\actual"/>
访问测试:虚拟路径
3.web.xml文件配置
3.1会话超时配置
conf web.xml <session-config>
<session-timeout>30(单位是分钟)</session-timeout>
</session-config>
3.2欢迎页配置
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
访问测试:欢迎进入tomcat