Requirement: replace the old user center with the user center developed in java recently. The environment Used for program development and testing is Tomcat 6, and jboss is used when it is planned to be deployed to the online environment, the main reason for jboss's support for hot deployment is that the user prompts 403 permission denied when using an ip address for access (this abnormal requirement is mainly caused by data center management, it is mainly for port 80). When using a domain name for access, the normal application environment is displayed. Introduction: Operating System: RedHatEnterpriseLinux5.464 bits
Requirements:
The old user center should be replaced with the user center developed in java recently. The environment Used for program development and testing is Tomcat 6, and jboss should be used when it is planned to be deployed to the online environment, the main reason for jboss's support for hot deployment is that the user prompts 403 permission denied when using an ip address for access (this abnormal requirement is mainly caused by data center management, mainly for port 80). When using the domain name for access, the application is displayed as normal.
Environment Introduction:
Operating System: RedHat Enterprise Linux 5.4 64-bit
System ip Address: 192.168.50.7/24
Apache + mod_jk + jboss
Apache version: 2.2.16
Mod_jk version: 1.2.31
Jboss version: jboss5.1 GA
Note: We have previously considered using a virtual host directly on jboss. However, when using an ip address or a domain name for access, 404 is displayed without log information; considering that only one user center application is deployed on the jboss container,
Therefore, the jboss virtual host is abandoned. If other java applications need to be deployed in the future, you can deploy multiple jboss instances on one server and listen to different ports.
- 1: Compile and install apache2.2.16
- Wget http://archive.apache.org/dist/httpd/httpd-2.2.16.tar.gz-P/usr/local/src/tarbag
- Tar-zxvf/usr/local/src/tarbag/httpd-2.2.16.tar.gz-C/usr/local/src/software
- Cd/usr/local/src/software/httpd-2.2.16 &
- ./Configure-- Prefix=/Usr/local/apache2.2.16 -- enable-so -- enable-rewrite -- enable-headers-- With-mpm=Worker-- Enable-expires-- Enable-mod-shared=All
- Make & make install
-
- 2: download and install jboss, which must be supported by java
- Java can be found on java.com
- Chmod u + x jdk-6u17-linux-i586.bin
- /Jdk-6u17-linux-i586.bin
- Mv jdk1.6.0 _ 17/usr/local/java
-
- Vi/etc/profile Add the following content to the end of the file
- ExportJAVA_HOME=/Usr/local/java
- CLASSPATH=/Usr/local/java/lib/dt. jar:/usr/local/java/lib/tools. jar
- PATH=/Usr/local/java/bin: $ PATH
- Export PATH JAVA_HOME CLASSPATH
-
- Source/etc/profile
- Wget http://nchc.dl.sourceforge.net/project/jboss/JBoss/JBoss-5.1.0.GA/jboss-5.1.0.GA.zip
- Unzip jboss-5.1.0.GA.zip-d/usr/local/
- Mv/usr/local/jboss-5.1.0.GA/usr/local/jboss5
-
- Delete default jboss applications, such as jmx-console and admin-console. (You can keep these applications if necessary)
- Cd/usr/local/jboss5/server/default/deploy
- Mkdir/bak/laji
- Mv admin-console.war jbossws. sar jmx-console.war jmx-remoting.sar management messaging/bak/laji
- Cp-rvp ROOT. war/bak/laji
- Rm-rf ROOT. war /*
-
- Modify the main configuration file of jboss as follows:
-
- <Service Name="Jboss. web">
-
- <Connector Port="8080" Address="0.0.0.0"
- MaxThreads="2500" Strategy="Ms" MaxHttpHeaderSize="8192"
- EmptySessionPath="True"
- EnableLookups="True" RedirectPort="8443" AcceptCount="100"
- ConnectionTimeout="20000" DisableUploadTimeout="True" Compression="On"
- CompressableMimeType="Text/html, text/xml, text/javascript, text/css, text/plain"
- UseIPVHosts="True"
- />
- Start jboss:/usr/local/jboss5/bin/run. sh-c default &
- (You can also use the nohup method to start it, or wait for the jboss to start up in the background and enter exit to exit the terminal, and then log on to the server again)
- Disable jboss:/usr/local/jboss5/bin/shutdown. sh-S
- 3: Configure mod_jk and apache
-
- Cd/usr/local/src/tarbag/
- Wget http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.31/x86_64/mod_jk-1.2.31-httpd-2.2.x.so
- Cp mod_jk-1.2.31-httpd-2.2.x.so/usr/local/apache2.2.16/modules/mod_jk.so
-
- Add the following content to the apache main configuration file:
- Grep 'jk '/usr/local/apache2.2.16/conf/httpd. conf
- Include conf/extra/mod_jk.conf
-
- The content of the newly added mod_jk.conf configuration file is as follows:
- Cat/usr/local/apache2.2.16/conf/extra/mod_jk.conf
- LoadModule jk_module modules/mod_jk.so // load mod_jk Module
- JkWorkersFile conf/extra/workers. properties // This file is used to control the jboss port for request forwarding.
- JkLogFile logs/mod_jk.log // mod_jk log
- JkLogLevel info // The log level is info.
- JkLogStampFormat "[% a % B % d % H: % M: % S % Y]" // log timestamp format
- JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories
- JkRequestLogFormat "% w % V % T" // log request format
- JkMount/* cas
- # JkMountFile conf/extra/uriworkermap. properties
- JkShmFile logs/jk. shm
- # Add jkstatus for managing runtime data
-
- <Location/Jkstatus/>
- JkMount status
- Order deny, allow
- Deny from all
- Allow from 192.168.50.8
- Allow from 127.0.0.1
-
Location>
-
- Cat/usr/local/apache2.2.16/conf/extra/workers. properties
- Worker. list=Cas
- # Define cas
- Worker. cas. port=8009
- Worker. cas. host=127. 0.0.1
- Worker. cas. type=Ajp13
- Worker. cas. cachesize=10
-
- Worker. XXX. port corresponds to the ajp port of the jboss application,
- Worker. XXX. host IP Address
- Note that JkMount/* XXX must be added to the list items of worker. list in mod_jk.conf; otherwise, apache cannot be started.
-
- Configure the apache VM as follows:
- Grep-v '^ #'/usr/local/apache2.2.16/conf/extra/httpd-vhosts.conf | grep-v '^ $'
- NameVirtualHost 192.168.50.7: 80
- <VirtualHost192.168.50.7: 80>
- ServerName 192.168.50.7
- <Location />
- Order deny, allow
- Deny from all
-
Location>
-
VirtualHost>
- <VirtualHost192.168.50.7: 80>
- ServerName jboss.766.com
- CustomLog "|/usr/local/apache2.2.16/bin/rotatelogs/usr/local/apache2.2.16/logs/jboss_log _ % Y % m % d 86400 480" combined
- Errorlog "log/jboss-error.log"
- RewriteEngine on
- JkMount/* cas
-
VirtualHost>
-
- /Usr/local/apache2.2.16/bin/apachectl-k restart
-
- Test:
- Tail-f/usr/local/apache2.2.16/logs/access_log
- 192.168.50.8--[06/May/2011: 13: 45: 28 + 0800] "GET/HTTP/1.1" 403 202
-
650) this. width = 650; "border = 0>
-
-
650) this. width = 650; "border = 0>
650) this. width = 650; "border = 0>
-
- Tail-f/usr/local/jboss5/server/default/log/localhost_access_log.2011-05-06.log
- 192.168.50.8--[06/May/2011: 15: 17: 28 + 0800] "GET/HTTP/1.1" 200 37