1. Configure www. ****. com domain name access
Configure the domain name (for example, www. ***. com), but does not want the customer to access the Default Root of Tomcat through the IP address or domain name of our website. The configuration method is as follows:
1. Open the/CONF/server. xml file in the tomcat installation directory.
2. In server. XML, set the original Name = "localhost" appbase = "webapps" ......> Change to Appbase = "webapps"...>
3. Create the directory "<name of the domain name you want to configure>" under the/CONF/Catalina directory, and then create the root. XML file in the format of/CONF/localhost. XML is consistent, but the content is as follows:
<? XML version = '1. 0' encoding = 'utf-8'?>
<Context
Displayname = "Welcome to 56 World! "Docbase =" D:/workplace/inbuilding"
Path = "">
</Context>
The content in docbase is what you want to open your domain name (www. ***. com)
The mapped directory and default webpage (for example, index. jsp)
4. Start the Tomcat server and enter the domain name to access the address you want to access.
2. Configure IP address access (project name not required)
Recently, I met a friend who suggested that the project configured in Tomcat should not be accessed using the previous access method "http: // 200.200.200.135: 8080/test, he just needs to enter an IP address for access.
So I checked the information on the Internet and found a solution, that is, to change the Tomcat server. the content in the XML file
[Host part of the original Tomcat server. xml file]
XML Code
<Host name = "localhost" appbase = "webapps"
Unpackwars = "true" autodeploy = "true"
Xmlvalidation = "false"
Xmlnamespaceaware = "false">
<! -- Singlesignon valve,
Share authentication between Web Applications
Documentation
At:/docs/config/valve.html -->
<! --
<Valve
Classname = "org. Apache. Catalina. authenticator. singlesignon"/>
-->
<! -- Access log processes all example.
Documentation at:/docs/config/valve.html -->
<! --
<Valve
Classname = "org. Apache. Catalina. Valves. accesslogvalve" directory = "logs"
Prefix = "localhost_access_log." suffix = ". txt" pattern = "common"
Resolvehosts = "false"/>
-->
</Host>
<Host name = "localhost" appbase = "webapps"
Unpackwars = "true" autodeploy = "true"
Xmlvalidation = "false"
Xmlnamespaceaware = "false">
<! -- Singlesignon valve, share
Authentication between Web Applications
Documentation:
/Docs/config/valve.html -->
<! --
<Valve
Classname = "org. Apache. Catalina. authenticator. singlesignon"/>
-->
<! -- Access log processes all example.
Documentation at:/docs/config/valve.html -->
<! --
<Valve classname = "org. Apache. Catalina. Valves. accesslogvalve"
Directory = "logs"
Prefix = "localhost_access_log ."
Suffix = ". txt" pattern = "common" resolvehosts = "false"/>
-->
</Host> [host part in the modified server. xml file]
XML Code
<Host
Name = "200.200.200.135" appbase = "webapps/membermanage"
Unpackwars = "true" autodeploy = "true"
Xmlvalidation = "false"
Xmlnamespaceaware = "false">
<Context Path = ""
Docbase = "."/>
<Context Path = "/membermanage"
Docbase = "."/>
</Host>
<Host
Name = "200.200.200.135" appbase = "webapps/membermanage"
Unpackwars = "true" autodeploy = "true"
Xmlvalidation = "false"
Xmlnamespaceaware = "false">
<Context Path = "" docbase = "."
/>
<Context Path = "/membermanage" docbase = "."/>
</Host> after name, you can enter an IP address or a domain name, such as www. OS .cn. After modification, you can directly access the domain name through http: // 200.200.200.135: 8080, you can see that you do not need to add the project name, but you still need to add the port number. My solution is to change the Tomcat access port to 80 (The premise is that the project has a separate server, port 80 must not be occupied by other software). In this way, you can directly use http: // 200.200.200.135 for access.
Note: The above method has passed the tomcat6.0 test. If tomcat5.x fails to be configured according to the above method, the <Context
Path = "" docbase = "."/> replace <context Path = "/" docbase = "."/>
Share: