Download, install, and configure the Tomcat server

Source: Internet
Author: User

The Tomcat server software is developed by apache and is available to everyone for free. You can download it directly from the apache Official Website: www.apache.org to download the installation version, or you can use the compressed version as long as it is decompressed)


1, Installation:

When Tomcat is running, JDK must be supported by JAVA. Therefore, to run tomcat after installation, you must configure the environment variable: Set the JAVA_HOME variable and set the variable value to the jdk path, after the configuration is completed, the JDK specified by JAVA_HOME will be automatically found for operations in the future when Tomcat is running.


1. Install JDK with JDK and JAVA_HOME)

2. decompress the compressed version to d: // unzip oft.

3. Install the version to d: // unzip oft.

Compression version is recommended for debugging and migration)



2UnderstandingTomcatFolder in the main directory:

·Bin: All executable files start the tomcat execution program here)

·Conf: configuration file. Modifications to the server must be made in this directory. For example, you must change the server port 8080)

·Logs: a log file that records server-related events. If an error occurs on the server, it is recorded here)

·Webapps: All executable WEB projects are stored in this directory.

·Work: temporary files of all projects are saved in this folder and will be updated automatically.


3, StartTomcatServer

Directly use startup. bat in the bin folder

Access Server: Start the browser and enter http: // localhost: 8080. If you see something like a cat and a tiger, it means it is successful)

If you access the server of another machine: http: // ip address: Port Number


4, ConfigurationTomcatRemember to restart the server after modifying the configuration file)

Learning to configure servers is required by every developer. You must be able to configure the server independently.

All tomcat configuration files are in the conf folder, and the server. xml file is the core configuration file.

· Modify the startup port of the server

Open the server. xml file in a text editor and find the HTTP-related port.


650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/152334H61-0.jpg "title =" Unnamed .jpg "/>


5, Configure virtual directory

For example, can I create a directory on a single disk and access it? If the directory is not in the default tomcat directory, it cannot be accessed. If you want to configure the required directory, there are strict requirements first. The configured virtual directory must have the following directory structure:

For example, create a new Demo folder on disk D.

Demo

|-WEB-INF

|-Web. xml configuration file with format requirements

At this time, does the server know that such a working directory exists on disk D? I don't know! All users who want the server to know must configure this working directory in the server. xml file

Add the following configuration in <Host> </Host>:

<Context path = "/demo" docBase = "D: \ demo"/>

· Path indicates the input path in the browser, which must contain "/"

· DocBase: The Path corresponds to the real directory on the hard disk.

If you run the virtual directory, the following situations occur:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/1523345391-1.jpg "title =" Unnamed .jpg "/>

This is because the directory list function is disabled in Tomcat, so you need to modify the web. xml file. However, when our project is actually released to the Internet, it is best to cancel the list function for security purposes.

Change the following false values to true.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/1523341a9-2.jpg "title =" Unnamed .jpg "/>





This article is from the "cainiao have e ambition" blog, please be sure to keep this source http://surong.blog.51cto.com/6118270/1293466

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.