Tomcat modified to its own project interface

Source: Internet
Author: User

Modify the Tomcat welcome interface for your own project interface posted on 2011-04-16 13:10 Icewee Read (1062) Comments (0) Edit collection belongs to Category: Tomcat because the project is to be published to the Internet, you must remove the port and project name from the test, and Its specified domain name access address.

First step, remove the port

Find Server.xml, change the default port 8080 to 80, and publish to the Internet must use 80 ports, so the port firewall will not intercept.

Step two, remove the project name

We may often use http://localhost:8080/xxx or http://127.0.0.1:8080/xxx to access our projects at the time of development, and through the first step we will now use the http://localhost/ XXX or http://127.0.0.1/xxx to access the project, you can also replace "localhost" or "127.0.0.1" with the host name. If now we are practical http://localhost/or HTTP://127.0.0.1/access, see will be Tomcat's welcome interface, the Internet, but it is not useful after testing, there is a statement test success, that is:

or modify Server.xml to configure the project virtual path in the Host tab. The previous test was to put Xxx.xml in Tomcat's conf/localhost, the file content is about:

<context path= "/xxx" docbase= "D:\xxx\xxx" debug= "0" reloadable= "true"/>


Now I'm going to change the value of path to "", start Tomcat, and find that the Tomcat welcome page is still there.

So this configuration is copied to the host tag, note to move the xxx.xml out, otherwise configured two times, the result is successful!

You can now use http://localhost to access your published projects!

Note:

The problem with this configuration may be that some of the features have errors, that is, the page cannot be displayed and the feature is not available. One of the possible reasons is that the project path is applied in the JSP of the project, such as: The src of the iframe equals xxxx/xxxx.do, do not write the project name as root, and use dynamic project and path, such as: ${pagecontext.request.contextpath }, currently we access the project root path has become "" (empty string), you use XXX to refer to the nature can not find the path and error. This is the benefit of using the dynamic project root path.

Tomcat modified to its own project interface

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.