Assume that the IP address 192.168.1.2 of a host HostA is bound to HOSTA. There are two J2EE applications APPA and APPB on the host, and the domain names www.linuxidc.com and www.linuxidc.net correspond to two applications respectively. Environment: centos5.6jdk1.6. xtomcat6.xapache2.2.3 deployment Description: apache forwards requests as a web Server
Assumptions:
One host, HostA, with the IP address 192.168.1.2 bound to HOSTA, has two J2EE applications, APPA and APPB, with the domain name www. linux.IdC.com and www.linuxidc.net correspond to two applications respectively.
Environment:
Centos 1, 5.6
Jdk1.6.x
ToMcAt6.x
Apache2.2.3
Deployment description:
Apache forwards requests to tom as a web ServerCatProcessing: tomcat is used as the application server to process requests. Only one application is deployed for each tomcat.
By default, you are familiar with jdk installation, tomcat deployment configuration, and apache deployment configuration.
1. Modify the hosts configuration file
- 127.0.0.1 hostname localhost www.domainain.com www.domainbin.com
Www.domainain.com and www.domainbin.com are appended for future use.
2. Deploy the application APPA
2.1 clear built-in tomcat applications and manage applications
Delete all directories under webapps
- Drwxr-xr-x 3 d t 4096 Aug 17 ROOT
- Drwxr-xr-x 10 d t 4096 Aug 17 docs
- Drwxr-xr-x 5 d t 4096 Aug 17 14:29ExAmples
- Drwxr-xr-x 5 d t 4096 Aug 17 host-manager
- Drwxr-xr-x 5 d t 4096 Aug 17 manager
Delete all files under conf/Catalina/localhost
- -Rw-r -- 1 d t 904 Aug 17 host-manager.xml
- -Rw-r -- 1 d t 904 Aug 17 manager. xm
2.2 modify server. xml
A. Modify the Host Node
Find the following configuration
- <Host Name="Localhost"AppBase="Webapps"
- UnpackWARs="TrUe" AutoDeploy="True"
- XmlValidation="FaLsE" XmlNamespaceAware="False">
Change
- <Host Name="Appa"
- UnpackWARs="True" AutoDeploy="True"
- XmlValidation="False" XmlNamespaceAware="False">
B. Modify the Engine Node
Find the following configuration
- <Engine Name="Catalina" DefaultHost="Localhost">
Change
- <Engine Name="Catalina" DefaultHost="Appa">
DefaultHost = "appa" to be associated Appa"Consistent.
2.3 add ROOT. xml configuration
Create a directory named appa in the conf/Catalina directory Appa"Consistent, the file content is as follows
- <Context DocBase="/Opt/app/apparoot"
- PrivilegEd="True" AntiResourceLocking="False" AntiJARLocking="False">
- Context>
2.4 place applications
Create the path in docBase = "/opt/app/apparoot" in step 1 (you do not need to create another ^-^ if you have already created the path ). Place the application in this directory.
Note: You can directly place the files in the application. In this way, you can directly access your application using http: // localhost: 8080.
2.5 start tomcat
After tomcat is started, you can access http: // localhost: 8080 on the local machine. If you can access the appa application, the configuration is successful. If an error occurs, view the logs in logs.
If there is no graphical interface, use wget http: // localhost: 8080 for testing.
3. Deploy APPB
The overall process is the same as that for deploying APPA. Note that you must modify the port numbers in tomcat deployed in APPB. We recommend that you adjust the port numbers in server. xml in a unified manner. The http port of APPB is 9080.