tomcat web study notes

Install tomcat web server

  1. 1) To make a file accessible to external users, there must be a similar network application to receive and respond to user requests
  2. 2) There are many types of web servers
    Java open source: tomcat6/7. . .
    Commercial: weblogic, websphere
  3. 3) Install tomcat
    a) Configure the correct version of JDK [at least JDK5] and path
    b) Execute tomcat/bin/startup.bat to start the web server
    c) CATALINA_HOME indicates which tomcat server needs to be started

    错误案例:

    a) The tomcat port is occupied, you can modify the default port number through the server.xml file
    b) View the current process usage, the tool Fport.exe
    c) The window flashes, and the JAVA_HOME directory setting is wrong

The meaning of the tomcat directory:

  • *bin/ script file to start and stop tomcat
  • *conf/Configure the text of tomcat, mainly xml file
  • Third-party jar packages used by *lib/tomcat
  • logs/tomcat server operation related log files
  • Some temporary files used when temp/tomcat is running
  • *webapps/tomcat can be accessed by the outside world and conform to the standard directory structure of web applications
  • The working directory where work/tomcat runs
Web standard directory structure:
tomcat/webapps directory

mail directory (web application or web project, there are many web static and dynamic resources under the web application)
 *.html(静态资源)

6)Web常用的编号
404:客户端请求的资源,服务端找不到

配置虚拟主机和目录

1) Virtual directory: Set the following code in the tomcat/conf/server.xml file:
<Context path="/qq" docBase="d:\mail"/>
path="Starting with / means virtual directory"
docBase= "The real directory of the web application" is
appended:
reloadable="false" The server will automatically monitor the changes in the /WEB-INF/classes or lib directory. Once it changes, the
service will automatically load the latest when it is set to true. If it is set to false, the server cannot load the
latest resources, and the server needs to be restarted manually. It is set to true in the development stage and false in the online stage.

        unpackWAR="true"服务器会自动将web压缩文件解压成标准的web目录结构

2) Set the default web application
<Context path="" docBase="d:\mail"/>
3) Set the default web resource
mail-WEB-INF-web.xml The following code is set:
<welcome-file-list>
<welcome-file>mail.html</welcome-file>
</welcome-file-list>

4) Set the virtual host: Set the following code in the tomcat/conf/server.xml file:
<Host name="www.163.com" appBase="d:\sina">
<Context path="" docBase="d :\sina\mail"/>
<Context path="/news" docBase="d:\sina\news"/>
</Host> name indicates the virtual host name, which corresponds to the appBase virtual host
defined in the HOSTS file
Web application root directory
\represents the real directory
/represents the directory accessed by the outside world through the browser
Take windowXP as an example: C:\WINDOWS\system32\drivers\etc\HOSTS file
5) Standard web applications located in the webapps/ directory, the server will automatically Map to a virtual directory
<Context path="/day04" docBase="d:\apache-tomcat-6.0.29\webapps\day04"/>
6) Some older versions of tomcat servers may not be able to automatically map the webapps/ directory For standard web applications, you need to add WEB-INF/web.xml file
7) Understand the characteristics of C/S and B/S structures
1) Domain Name Service
2) DNS is a mapping relationship between a domain name and IP address within the telecom
3) Before querying DNS, check the corresponding local operating system HOSTS file, can you find the corresponding IP? If you can find it, you will not check the DNS. Only if you can't find it, you can
connect to the Internet to find the DNS server.
4) CS structure: program and data are separated on different sides
*BS structure: program and data are bound on the server side

tomcat web study notes

Guess you like

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