1, the port number of access can be modified in the/conf/server.xml file, the browser default access port number is 80, if the server port number is 80 does not need to write the port number in the Address bar.
2. If the port is occupied, you can use the Netstat-ano command to view the process PID that occupies the port, and then close it with the task Manager.
3, after configuring the Catalina_home environment variable in the user variable, only tomcat under the environment variable directory will be started during the startup process.
4. Tomcat directory structure
Bin----The directory where the required bat files are started and closed
Conf---configuration directory
LIB---the directory where the Tomcat runtime requires a jar package
Logs the directory where the log files are located---
Temp---The directory where the temporary files are stored when the Tomcat runtime does not require us to manage
WebApps---The most commonly used directory in the development, Web applications placed in this directory can be accessed directly by the browser
Work---Working directory, the working files generated by Tomcat runtime are stored in this directory
5. Configure the Virtual host:
5.1, in the Conf/server.xml <Engin> tags under the configuration <Host> tag can add a virtual host for Tomcat
5.2, name-Specifies the name of the virtual host, which the browser accesses to the virtual host
5.3, AppBase--Virtual Host management directory, the Web application placed in this directory the current virtual host can be loaded automatically
* As the browser accesses the address, the address needs to be translated into the corresponding IP to find the server, where the translation process is implemented by the DNS server. There is no way to modify the DNS server when we are doing the experiment, and the hosts file can be used to simulate the DNS function to complete the experiment.
* Default Virtual Host: If the visitor is accessed via IP, this time the server will not be able to discern which virtual host is currently accessing the resource, and then access the default virtual host. The default virtual host can be configured by Defaulthost property on the Engin label in Server.xml.
To configure a web app for a virtual host:
(1) in Server.xml <Host> tag, configure <Context> tag, you can configure a Web app for this virtual host
If path is set to NULL, this web app is the default Web App.
This configuration requires restarting the server and does not recommend
(2) in tomcat/conf/[engin]/[host]/(see the name of Engin and Host in Server.xml) write an XML file in this directory where the name of the XML file is the virtual path, which can be configured in this XML < The context> tag, which configures the true path.
If the configured virtual path has/because the file name does not allow the inclusion/need # substitution, as long as the file name is set to root.xml the XML description of the Web application becomes the default Web application
This configuration does not need to restart the server, recommended
(3) Directly put the Web application into the directory managed by the virtual host, the Web application can be found by the virtual host to manage this Web application
As long as you change the name of the Web App folder to root, this web app is the default Web App
Virtual path mapping for *web applications--To configure a browser-accessible virtual path for a real-world path to a Web application
* Configure the Default Web App-the default Web app to access the Web app when the Web app name is not written, path is set to NULL
6. Configure the Virtual host:
Configure <Host> tag in the Conf/server.xml <Engin> tab to add a virtual host to Tomcat
Name-Specifies the hostname of the virtual host to which the browser accesses the virtual host
AppBase--Virtual Host management directory, Web application placed in this directory the current virtual host can be loaded automatically
* As the browser accesses the address, the address needs to be translated into the corresponding IP to find the server, where the translation process is implemented by the DNS server. There is no way to modify the DNS server when we are doing the experiment, and the hosts file can be used to simulate the DNS function to complete the experiment.
* Default Virtual Host: If the visitor is accessed via IP, this time the server will not be able to discern which virtual host is currently accessing the resource, and then access the default virtual host. The default virtual host can be configured by Defaulthost property on the Engin label in Server.xml.
Javaweb Learn the first day of the Tomcat server configuration