After you install Tomcat, the default is Tomcat's home page, so how do you point the home page, "http://127.0.0.1:8080", to our own home page? This is going to set up Tomcat's virtual directory.
In a previous version of Tomcat, such as "Tomcat 5.0.14" and previous versions, expand "tomcat>conf", you can see a "server.xml" file, open it with Notepad, in the last part of the document has a commented "< Context> tab, use this tab to configure the virtual directory. But for some reason, this tag was added to the later version of Tomcat and we had to manually add this tag.
Now for a specific description of the virtual directory configuration:
Expand tomcat5.x.x>conf and use Notepad to open "server.xml" to move the cursor to the end of the file with the following code:
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/>
</Host>
</Engine>
</Service>
</Server>
Add the following code before the </Host> label
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/>
<Context path="" docBase="E:\myapps" debug="0"></Context>
<Context path="/test" docBase="F:\mytest" debug="0" ></Context>
</Host>
</Engine>
</Service>
</Server>
The red part of the code is the code that is just added, where "path" refers to the directory in the URL, and if it is empty, it maps to "http://127.0.0.1:8080" (the Tomcat default port is 8080), and if "/test" is mapped to "http:// 127.0.0.1:8080/test ". This way in the browser to enter the above Web site can be accessed, of course, you can add other virtual directories.
By the way, change Tomcat's port number to the default "80", only to be changed in the "Server.xml" file:
<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />
Change "8080" in the code to "80" to use IE default port access, that is, enter the URL can not add a port number such as: "http://127.0.0.1."