First configure apache conf directory establish mod_jk.conf file, which reads as follows:
LoadModule jk_module modules / mod_jk.so
The Xml code Favorites code
JkWorkersFile / usr/local/apache2/conf/workers.properties
JkLogFile logs / mod_jk.log
# Set the jk log level [debug / error / info]
JkLogLevel info
# Select the log format
JkLogStampFormat “[% a% b% d% H:% M:% S% Y]”
# JkOptions indicate to send SSL KEY SIZE,
JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat “% w% V% T”
JkMount / servlet / * worker1
JkMount / *. Jsp worker1
# JkMount / * loadbalancer
# Apache will serve the static picture.
# This means that all images will be parsed by APACHE
# JkUnMount / *. Jpg loadbalancer
# JkUnMount / *. Gif loadbalancer
# JkUnMount / *. Swf loadbalancer
# JkUnMount / *. Bmp loadbalancer
# JkUnMount / *. Png loadbalancer
Establish worker.properties content is as follows:
The Xml code Favorites code
# Worker.list = loadbalancer, server105, server106
worker.list = worker1
# Set properties for worker1
worker.worker1.type = ajp13
worker.worker1.host = localhost
worker.worker1.port = 8009
worker.worker1.lbfactor = 50
worker.worker1.cachesize = 10
worker.worker1.cache_timeout = 600
worker.worker1.socket_keepalive = 1
worker.worker1.socket_timeout = 300
# Define the first node …
# Worker.server105.port = 9090
# Worker.server105.host = 127.0.0.1
# Worker.server105.type = ajp13
# Worker.server105.lbfactor = 1
# # Worker.server105.local_worker = 1
# Worker.server105.cachesize = 100
# Define the 2nd node …
# Worker.server106.port = 9090
# Worker.server106.host = 127.0.0.1
# Worker.server106.type = ajp13
# Worker.server106.lbfactor = 1
# Worker.server106.local_worker = 1
# Worker.server106.cachesize = 100
# Now we define the load-balancing behaviour
# Worker.loadbalancer.type = lb
# Worker.loadbalancer.balanced_workers = server105, server106
# Worker.loadbalancer.sticky_session = 1
Finally, you need to join in httpd.conf:
The Xml code Favorites code
Include conf/mod_jk2.conf
At this time start will be reported to not find mod_jk.so the error, you need to manually generate, go to http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/source/ address to download a jakarta-tomcat- connectors-jk-1.2.6-src.tar.tar
Can then be compiled to generate:
The Xml code Favorites code
# Tar xzvf jakarta-tomcat-connectors-jk-1.2.6-src.tar.tar
# Cd jakarta-tomcat-connectors-jk-1.2.6-src/jk/native
#. / Configure – with-apxs = / usr/local/apache2/bin/apxs
# Make
# Cp ./apache-2.0/mod_jk.so / usr/local/apache2/modules /
Configured to apache part next jboss, jboss do not have to configure, modify ports, do not tell apache port conflicts can, the default is 8080, change 9090 like configuration file in jboss-4.0. 5.GA/server/default/deploy/jbossweb-tomcat55.sar/server.xml.
To done here, to engage in a war package, which is simple to get hold of jsp files, source code such as:
The Html code Favorites code
Hello ~ ~ ~ ~
Image: <img src=”10.jpg”/>
War on jboss default / deploy directory, start jboss and apache jsp files through apache port access war package to try it! ~ ~
Then the question came, my html files on apache at, war package named Test, that I visited the project file is http://www.test.com:8080/Test/index.html, but such access does not to mod rules selvet and jsp Jump to jboss html in apache, but the apache not established Test directory, how to make him jump to apache static files of the same name in the specified directory at it?
Corresponding VirtualHost httpd.con plus RewriteRule ^ / the WebTest / (*) html / $ 1.html [R, NE], such access will jump up.
The same used in the jsp jpg file, you need to jump to the apache default directory, you need to add RewriteRule ^ / the WebTest / (*). Jpg / $ 1.jpg [R, NE];
Complete httpd.conf VirtualHost configuration:
The Xml code Favorites code
<VirtualHost *>
ServerAdmin sefer@xiaofeng.com
DocumentRoot / usr/local/apache2/htdocs/sefer
ServerName www.test.com
ErrorLog logs / test.sefer.com-error_log
TransferLog logs / test.sefer.com-access_log
RewriteEngine On
RewriteRule / test / (. *) / Index.html [R, NE]
RewriteRule / out / (. *) Http://www.163.com [R, NE]
RewriteRule ^ / WebTest / (. *). Html / $ 1.html [R, NE]
RewriteRule ^ / WebTest / (. *). Jpg / $ 1.jpg [R, NE]
</ VirtualHost>
So that the picture can come out, the the access http://www.test.com:8080/WebTest/index.html jump directly to http://www.test.com:8080/index.jsp.
Recent Comments