The method described in this article is implemented by adding a different port-number approach. The method is as follows:
1, modify ... /tomcat/conf/server.xml, the original code is as follows:
<service name= "Catalina" >
<connector connectiontimeout= "20000" port= "8080" protocol= "http/1.1" redirectport= "8443"/>
<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>
<Engine defaulthost= "localhost" name= "Catalina" >
<realm classname= "Org.apache.catalina.realm.LockOutRealm" >
<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm" resourcename= "Userdatabase"/>
< /realm>
2, add a new port number, the code is as follows:
Note ModifyService name; Connector port; Engine name; Host appBase
<service name= "Catalina1" >
<connector connectiontimeout= "20000" port= "8090" protocol= "http/1.1" redirectport= "8443"/>
<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>
<Engine defaulthost= "localhost" name= "Catalina1" >
<realm classname= "Org.apache.catalina.realm.LockOutRealm" >
<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm" resourcename= "Userdatabase"/>
</Realm>
3, create a directory
A. Create the directories that need to be deployed ../Tomcat/webapps1
and copy the items that need to be deployed to the directory;
B. Creating a configuration file directory../Tomcat/conf/Catalina1/localhost
4, modify the project code
In my attempt to find a more error-prone place, is the best modification web.xml
and log4j.properties
configuration files.
Where web.xml
the file needs to be added webAppRootKey
, the code is as follows:
Upper node is Web-app
<context-param>
<param-name>webAppRootKey</param-name>
< Param-value>mos_ms.root</param-value>
</context-param>
Log4j.properties, the modified log4j.appender.org.apache.log4j.DailyRollingFileAppender.File
value, the code is as follows:
Specific location customization, but need to be
Log4j.appender.a=org.apache.log4j.dailyrollingfileappender
in ${catalina1.home} Log4j.appender.a.file=${catalina1.home}/logs/gyl_log/purepro_
5, make the corresponding changes
Startup Tomcat,webapps directory and WEBAPPS1 directory application will be started, can be based on different ports to access the inside of the project; Assuming the project name is MyApp, for the above changes we can use the following address to access: http://localhost : 8080/myapp or HTTP://LOCALHOST:8090/MYAPP.
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange.