| 1. Download To the official Apache website, we can easily find tomcat, such: Http://tomcat.apache.org/download-60.cgi Here, we can download three installation packages, zip、tar.gz and Windows Service installer of Tomcat 6.0.16. among them: Zip is a free-of-installation version in windows. It can be used normally only after decompression and manual configuration; Tar.gz is the installation package in Linux; Windows Service installer is obviously the installProgram, You can automatically install it after double-clicking. Here I will mainly talk about how to use the zip package to extract the configuration, then we need to download this file: apache-tomcat-6.0.16.zip 2. decompress and configure Before installing Tomcat, we must first install JDK, which is supported by the Java Runtime Environment. Therefore, we must first install and configure JDK. The JDK installation program can go to the official website of sun. Here we will describe the JDK installation in detail. After JDK is installed, configure the following environment variables: Java_home = JDK installation directory Classpath =., % java_home % \ Lib \ RT. Jar Path = % java_home % \ bin; original content Decompress apache-tomcat-6.0.16.zip to the C: \ tomcat6 folder. Here is our tomcat. After decompressing tomcat, we also need to set several environment variables: Catalina_home = Tomcat decompress the directory. Here we are catalina_home = c: \ tomcat6. Classpath = % catalina_home % \ Lib; original content If this keyword is not found during environment variable configuration, add a new item. If there is already a path, add new content based on the original content value, the new content and the original value are separated by semicolons. After configuring the above content, you can restart the system. 3. Run After the system is restarted, go to the bin directory under the Tomcat decompression directory and find startup. BAT file. This file is the Tomcat Startup File. Double-click this file to open a command line window. Some Tomcat startup loading information is displayed. The last line should be: Information: server startup in XXX MS This means that your server has been started successfully. You can open your browser and enter the following in the address bar: Http: // localhost: 8080 Check whether you can see the Tomcat page. To facilitate the startup, we can create a shortcut for the startup. BAT file to the desktop, and then we can directly use this shortcut. Note that Tomcat started in this way will have a command line window in front of you. This is the startup server. Do not close it, if you close this window, your Tomcat server will be closed. Remember to remember. Here, the default Tomcat server port is not modified during configuration, so it is 8080. To modify the port, go to the conf directory of the tomcat installation directory and find the configuration file "server. xml: <Protocol = "HTTP/1.1" Port = "8080" Connectiontimeout = "20000" Redirectport = "8443" type = "regxph" text = "yourobjectname"/> The Port = "8080" is the port when the server is started. You can change it to the port you want to set, but do not conflict with the port used by other software, once a port conflict occurs, Tomcat cannot be started. You can also configure your own virtual directory in this configuration file and find the followingCode: <Host name = "localhost" appbase = "webapps" Unpackwars = "true" autodeploy = "true" Xmlvalidation = "false" xmlnamespaceaware = "false"> <Context Path = "/test" docbase = "D: \ test" reloadable = "true"/> </Host> The configuration information of the virtual directory is written on the server. between the labels in the XML configuration file, the path in the configuration code is the path name of the virtual directory used for access in the browser, for example, the path value we configured above is "/test", and the Backslash "/" in this value is indispensable. After this value is configured, the path for accessing the virtual directory in the browser is as follows: Http: // localhost: 8080/test Another parameter, docbase, is the actual storage address of the virtual directory. In the preceding configuration example, the D: \ test directory is configured as the virtual directory named test. 4. Install the service In this case, Tomcat needs to be manually started every time. If you want the Tomcat server to be automatically started when the system is started, we can register it as a system service, the registration method is as follows: Run cmd to open the command line window and go to the bin directory of the Tomcat decompression directory. Here we go to c: \ tomcat6 \ bin, and then run the following command: service. bat install, the tomcat6.exe file will be registered as a system service. We are running services. MSC and open the system service to check if an "Apache Tomcat" service is added? However, the Startup Type of this service is manual. We can change it to automatic, so that the Tomcat server will automatically start as the system starts. If you do not want this service, run the following command in the command line window: C: \ tomcat6 \ bin: C: \ tomcat6 \ bin \ service. Bat remove You can remove this service. 5. Summary Following the steps above, we can easily implement the manual configuration of the Tomcat server. Compared with the installation package installed automatically, this manual method does not seem complicated, in addition, you can learn more about tomcat configuration through this manual method, and configure it flexibly as needed. Therefore, you should master the manual configuration method during development and usage. Source:Http://aijcjo.iteye.com/blog/710065 |