Tomact Configure the domain name and port directly to the site, is to use the domain name resolution to the host, through the port to perform Web site address, access, in the previous chapter published two Web projects, but all are executing the same root folder, by
The http://localhost:8080/project name is accessed at such an address.
The following is implemented by configuring the Server.xml file under the Conf folder under the Tomcat installation address, implementing the binding domain name and specifying the port to the directory implementation domain name plus port access website
1. Configure two virtual domain names first. Open the following directory: C:\Windows\System32\drivers\etc Select the Hosts editor
Add the following two records, 10.0.0.217 is my native intranet IP address, save.
2. Open the Server.xml file under the Conf folder under the Tomcat installation address: Add the server node under the server peer with the following XML nodes:
<service name="Catalina"> <connector port="50002"Protocol="http/1.1"ConnectionTimeout="20000"Redirectport="8443"/> <connector port="8009"Protocol="ajp/1.3"redirectport="8443"/> <engine name="Catalina"defaulthost="localhost"> <realm classname="Org.apache.catalina.realm.LockOutRealm"> <realm classname="Org.apache.catalina.realm.UserDatabaseRealm"resourcename="Userdatabase"/> </Realm> "aaa.com"Appbase="WebApps"Unpackwars="true"autodeploy="true"> <context path=""Docbase="/javaweb_testrelease01"reloadable="true"/> <valve classname="Org.apache.catalina.valves.AccessLogValve"directory="logs"prefix="Localhost_access_log"suffix=". txt"pattern="%h%l%u%t"%r"%s%b"/> </Host> </Engine> </Service> <service name="Catalina"> <connector port="50003"Protocol="http/1.1"ConnectionTimeout="20000"Redirectport="8443"/> <connector port="8009"Protocol="ajp/1.3"redirectport="8443"/> <engine name="Catalina"defaulthost="localhost"> <realm classname="Org.apache.catalina.realm.LockOutRealm"> <realm classname="Org.apache.catalina.realm.UserDatabaseRealm"resourcename="Userdatabase"/> </Realm> "bbb.com"Appbase="WebApps"Unpackwars="true"autodeploy="true"> <context path=""Docbase="/JAVAWEB_TESTRELEASE02"reloadable="true"/> <valve classname="Org.apache.catalina.valves.AccessLogValve"directory="logs"prefix="Localhost_access_log"suffix=". txt"pattern="%h%l%u%t"%r"%s%b"/> </Host> </Engine> </Service>
Where the new server node 1 is bound to the aaa.com domain port is 50002, the/JAVAWEB_TESTRELEASE01 directory is executed
Where the new server node 2 is bound to the bbb.com domain port is 50003, the/JAVAWEB_TESTRELEASE02 directory is executed
Stop Tomcat and restart Tomcat
Run in Browser: http://aaa.com:50002/
Run in Browser: http://aaa.com:50002/
Tomact Configuring domain names and ports to access websites directly