First, you may need to purchase a domain name, and then manage the domain name, click "domain name resolution", add resolution,
Select A record and set the domain name to be resolved and the Internet IP address of your linux system.
The so-called top-level domain name is the domain name subject without a prefix (except www), such:
Http://pwdgame.com/
Http://www.pwdgame.com/
The so-called second-level domain name contains a prefix, such:
Http://cctv.pwdgame.com/
Http://china.pwdgame.com/
Second-level domain names are allocated based on top-level domain names. Without top-level domain names, there will be no second-level domain names. (The above is purely personal understanding)
Step 1:
Copy the entire webapp in the default tomcat directory.
Copy three copies to apply to three applications.
Then, put all your three application files under the root of the webapp (delete the original files first)
Such:
Webbench 1 \ ROOT Place your first website
Webbench 2 \ ROOTPlace your second website
Baidu_apps \ ROOT Place your third website
This is because you cannot directly configure the webapps/sub-directory in Tomcat. I tried to write sub-directories. Tomcat cannot find the absolute directory. Only the sub-directories above can be used, windows system does not try. (You can leave a message if you have a good method)
Step 2:
Use linux Command Line
# vim /apache-tomcat/conf/server.xml
/Apache-tomcat opens the directory for your Tomcat and press I to enter the editing mode. Press esc to exit the editing mode and enter the General mode.
Change the default tomcat port to 80
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" URIEncoding="UTF-8" redirectPort="8443" />
The default value is 8080, which does not include Character Set settings. You can also set it here.
Note that different hosts are different domain names.
AppBase is the webapp that you copy and re-Place your program to the root user.
<Engine name="Catalina" defaultHost="www.pwdgame.com"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <Host name="www.pwdgame.com" appBase="webapps1" unpackWARs="true" autoDeploy="true" > <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="webapps1_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> <Host name="bbs.pwdgame.com" appBase="webapps2" unpackWARs="true" autoDeploy="true" > <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="webapps2_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
</Host> </Engine>
Press esc to exit the editing mode and press the button to enter
Save and exit
Restart Tomcat
# /apache-tomcat/bin/shutdown.sh# /apache-tomcat/bin/startup.sh
Open
Http://www.pwdgame.com/
Success !!!!!!