Servlet study notes (1): Detailed explanation of Web server and Tomcat

1. Port

http 80

smtp 25

pop3 110

ftp  23

https 443


Second, tomcat

(1) Start

1. java_home environment variable

2. Port occupancy: tool to view ports (fport.ese)

3. Modify the port of Tomcat: conf/server.xml configuration file

4、http://www.sina.com/ :

1) Domain name: .sina.com

2) URL address: http://www.sina.com/ 

3) Hostname: www.sina.com

5. Catalina_home environment variable


(2) Tomcat directory structure


(3) Mapping of web applications and virtual directories

1. After the web application is developed, if you want to share it with the outside world, you need to hand over the directory where the web application is located to the server for management. This process is called virtual directory mapping.

2. Implementation: Configure the server. If configured in tomcat's server.xml, you need to restart the server

1) path: virtual directory. If path is empty, it is the default access.

2) docBase: web application directory

<Context docBase="D:\eclipse\eclipse-DW\DEV224-1\ui" path="/lis" reloadable="true"/>

3. Other 4 ways to configure Context

1) Configured under <host> in /conf/context.xml, it will be shared by all applications. As configured web.xml

2) In /conf/[enginename]/[hostname]/context.xml.default will be shared by all applications.

3) Put any .xml file in /conf/[enginename]/[hostname]/ and write <Context/>.

The name of this file is the external access path, that is, path: virtual directory. If the file is a.xml, then the access is localhost:8080/a/XX.jsp

4)在第三种基础上,还可以实现多级,只要修改xml文件名称。如a#b#c.xml 访问的路径为a/b/c/XX.jsp

5)在在第三种基础上,缺省的配置:修改文件名称为 Root.xml,需要重启。

4、tomcat自动映射:tomcat服务器会自动管理webapps目录下的所有web应用,并把它映射成虚拟目录。

换句话说,tomcat服务器webapps目录中的web应用,外界可以直接访问。


(四)Web应用的组成结构

1、web.xml


(五)配置虚拟主机

1、在服务器中,如tomcat中配置一个网站

2、如需在web服务器中配置一个网站,使用host元素进行配置(在tomcat的server.xml中配置)

<Host name="www.sina.com" appBase="c:\sina">
<Context path="/mail" docBase="c:\sina\mail" />
</Host>


3、配置的主机要想被外部访问,必须在DNS服务器或windows系统中注册。

1) ping www.sina.com 得到IP地址

2)修改windows配置:C:\Windows\System32\drivers\etc\hosts


(五)tomcat体系结构和配置https连接器

1、对称加密

2、非对称加密(公钥、私钥)

1)验证公钥:CA机构,数字证书(公钥)

2)数字签名(私钥)


(六)tomcat管理平台

1、用户配置:tomcat-user.xml 管理员角色<role rolename="manager"/>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326014406&siteId=291194637