Installing the Tomcat Web server
- 1) to bring a file to the outside user access, must have a similar network application to receive and respond to user requests
- 2) There are several types of Web servers
Java Open Source: Tomcat6/7 ...
Commercial: Weblogic,websphere
3) Install Tomcat
A) Configure the correct JDK version [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 and the default port number can be modified via the Server.xml file
b) View current process usage, tool Fport.exe
c) The window flashes past, Java_home directory settings error
What the Tomcat directory means:
- *bin/to start and stop Tomcat script files
- *conf/Configure Tomcat text as XML file-based
- Third-party jar packages used by *lib/tomcat
- Logs/tomcat log files related to server operations
- Temp/tomcat Some temporary files used by the runtime
- *webapps/tomcat Web applications that can be accessed by the outside world in accordance with the standard directory structure
- Working directory for Work/tomcat running
Web Standard directory structure: Tomcat/webapps Directory
|
Mail directory (web app or Web project, with n multiple Web static 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= "Start with/to represent the virtual directory"
Docbase= "web App's real directory"
Additional:
Reloadable= "false" server will automatically monitor changes in the/web-inf/classes or Lib directory, once the change, service turbulence
When set to True, the latest content is loaded automatically, and if set to False, the server cannot load the most
The new resource requires a manual restart of the server, the development phase is set to true, and the on-line stage is set to false.
unpackWAR="true"服务器会自动将web压缩文件解压成标准的web目录结构
2) Set the default Web App
<context path= "" docbase= "D:\mail"/>
3) Set the default Web resource
The following code is set in the Mail-web-inf-web.xml file:
<welcome-file-list>
<welcome-file>mail.html</welcome-file>
</welcome-file-list>
4) Set up the virtual host: Set the following code in the Tomcat/conf/server.xml file:
<context path= "" docbase= "D:\sina\mail"/>
<context path= "/news" docbase= "D:\sina\news"/>
</Host>
Name indicates the virtual hostname, consistent with the definition in the Hosts file
Web application root for appbase virtual host
\ represents the Real directory
/indicates a directory accessed by the outside world through a browser
Take WINDOWXP as an example: C:\WINDOWS\system32\drivers\etc\HOSTS file
5) standard Web application 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 tomcat servers may not be able to automatically map standard Web apps under the webapps/directory and need to add web-inf/web.xml files.
7) Understand the characteristics of C/s and b/s structure
1) Domain Name Service
2) DNS is a mapping between a domain name and an IP address within a telco
3) before querying DNS, first check the local operating system corresponding to the hosts file, can find the corresponding IP, if you can find, will not check DNS, only in
If it is not found, then connect to the network to find the DNS server
4) CS Structure: Separation of programs and data on different ends
*BS structure: Program and data binding on the server
Tomcat Web Learning Notes