Tomact Configuring domain names and ports to access websites directly

Source: Internet
Author: User

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

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.