http://blog.csdn.net/stevenyanzhi/article/details/6029776
Tomcat binds multiple IP addresses
If there are multiple IP addresses on a server and multiple projects how does an IP address bind each project?
Here's a simple record:
Find Tomcat 5.0/conf/server.xml Search
Unpackwars= "true" autodeploy= "true"
Xmlvalidation= "false" Xmlnamespaceaware= "false" >
<context path= "/" docbase= "/webapps" reloadable= "true" debug= "0" ></Context>
</Host>
Add the following
<context path= "" docbase= "." />
</Host>
Then in your server root directory under the new folder WEBAPPS2 put your other project in the OK .
Description: Here's localhost1,localhost2 you can fill in your IP address.
Tomcat uses the default installation, in order to Tamcat directly bind multiple domain names, here we need to modify the configuration file: C:/Program files/apache software Foundation/tomcat 5.5/conf/server.xml
Server.xml is modified in the following ways:
(i) Multi-domain binding
1. If you want to bind the Web site, first of all is to change the Tomcat's default access port 8080 to 80
Original:
<connector port= "8080" maxhttpheadersize= "8192" maxthreads= "" "minsparethreads=" maxsparethreads= "75" Enablelookups= "false" redirectport= "8443" acceptcount= "" connectiontimeout= "20000" disableuploadtimeout= "true"/ >
After modification:
<connector port= "maxhttpheadersize=" 8192 "maxthreads=" "minsparethreads=" maxsparethreads= "75" Enablelookups= "false" redirectport= "8443" acceptcount= "" connectiontimeout= "20000" disableuploadtimeout= "true"/ >
In fact, this is the port:8080, modified to port:80 on it, the other parameters unchanged
2. Next is the focus of haha ...
Original:
<engine name= "Catalina" defaulthost= "localhost" >
</Engine>
Of course, I've removed all the comment codes here, and the province is an eyesore.
After modification:
<engine name= "Catalina" defaulthost=www.abc.com>
</Engine>
Here to explain the configuration above
Engine Dafaulthost: Indicates access to the Tomcat by default into the host, note must not be localhost, or others through your IP access, will default into the Tomcat management interface.
Host Name: Represents the domain name that the host is bound to, and if bound localhost can access the host by entering localhost in the browser.
Host AppBase: Represents the file storage path that the host binds to, either using a relative path or an absolute path.
Follow the configuration above:
1. If I enter http://localhost in the browser, then visit C:/Program files/apache software foundation/tomcat 5.5/webapps/root website
2. If you enter http://www.abc.com, visit the website under C:/Program files/apache software Foundation/tomcat 5.5/abcapps/root
3. If you enter http://www.cba.com, visit the website under D:/cba/root.
Note that there is a root directory that needs to be created, and we simply place the site in the appropriate root directory to access it through the corresponding domain name.
There are many parameters in this, I am not very clear, but this can be done to achieve multi-domain binding haha. and the Site page modified as long as the direct overlay can be, Tomcat can automatically update the class and page, of course, if you modify the Web. xml or LIB, you need to restart Tomcat.
(ii) virtual directory
Unpackwars= "true" autodeploy= "true"
Xmlvalidation= "false" Xmlnamespaceaware= "false" >
<context path= "/cqq" docbase= "F:/java/cqqapp" debug= "0" reloadable= "true" crosscontext= "true" >
</Host>
Where the host tag is used to configure the virtual host, that is, multiple domain names can point to a tomcat, the format as long as the reference to the default
OK.
<context> is the child element of the host tag, which represents a virtual directory, which has two properties, and path is the virtual directory name.
The docbase is the specific file location. Here my virtual path name is CQQ, in fact my program is HTML, JSP,
The servlet is placed under the F:/java/cqqapp directory.
So I can access my virtual directory through http://127.0.0.1/cqq/.
Another approach is to:
Configure two sites
<context path= "" docbase= "D:/tomcat5.5/portal" debug= "0" reloadable= "true"/>
</Host>
Unpackwars= "true" autodeploy= "true"
Xmlvalidation= "false" Xmlnamespaceaware= "false" >
<context path= "" docbase= "d:/tomcat5.5/abc" debug= "0" reloadable= "true"/>
</Host>
After this setting, the input domain name can be divided into two sites
However, because the default site is not specified, it cannot be accessed when the IP is entered directly.
So add D:/tomcat5.5/conf/catalina/localhost/root.xml.
Content such as
<context path= "/" docbase= "${catalina.home}/portal" debug= "5" reloadable= "true" crosscontext= "true" >
</Context>
This can be implemented to enter the domain name to a site, enter the IP on the default to d:/tomcat5.5/portal this site
But, however, the problem arose.
These two sites start to consume quite a memory, Tomcat memory settings I have set to 1400M (again high TOMCAT5 cannot boot), so can not start three applications at the same time.
Do you have a way to start an application and bind multiple domain names?
The following (so that Tomcat is definitely not bootable, just to express my meaning)
Unpackwars= "true" autodeploy= "true"
Xmlvalidation= "false" Xmlnamespaceaware= "false" >
<context path= "" docbase= "d:/tomcat5.5/abc" debug= "0" reloadable= "true"/>
</Host>
Because I am integrated, so I don't have to change the port 8080 Oh ~~~~~
Tomcat binds multiple IP addresses multi-domain binding