{"id":1132,"date":"2012-08-27T15:14:04","date_gmt":"2012-08-27T07:14:04","guid":{"rendered":"http:\/\/rmohan.com\/?p=1132"},"modified":"2012-08-27T15:14:04","modified_gmt":"2012-08-27T07:14:04","slug":"integration-apache-and-jboss","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=1132","title":{"rendered":"integration apache and jboss"},"content":{"rendered":"<p>\u00a0 First configure apache conf directory establish mod_jk.conf file, which reads as follows:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0LoadModule jk_module modules \/ mod_jk.so<br \/>The Xml code Favorites code<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0JkWorkersFile \/ usr\/local\/apache2\/conf\/workers.properties<br \/>\u00a0\u00a0\u00a0\u00a0JkLogFile logs \/ mod_jk.log<br \/>\u00a0\u00a0\u00a0\u00a0# Set the jk log level [debug \/ error \/ info]<br \/>\u00a0\u00a0\u00a0\u00a0JkLogLevel info<br \/>\u00a0\u00a0\u00a0\u00a0# Select the log format<br \/>\u00a0\u00a0\u00a0\u00a0JkLogStampFormat &#8220;[% a% b% d% H:% M:% S% Y]&#8221;<br \/>\u00a0\u00a0\u00a0\u00a0# JkOptions indicate to send SSL KEY SIZE,<br \/>\u00a0\u00a0\u00a0\u00a0JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories<br \/>\u00a0\u00a0\u00a0\u00a0# JkRequestLogFormat set the request format<br \/>\u00a0\u00a0\u00a0\u00a0JkRequestLogFormat &#8220;% w% V% T&#8221;<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\u00a0\u00a0\u00a0\u00a0JkMount \/ servlet \/ * worker1<br \/>\u00a0\u00a0\u00a0\u00a0JkMount \/ *. Jsp worker1<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\u00a0\u00a0\u00a0\u00a0# JkMount \/ * loadbalancer<br \/>\u00a0\u00a0\u00a0\u00a0# Apache will serve the static picture.<br \/>\u00a0\u00a0\u00a0\u00a0# This means that all images will be parsed by APACHE<br \/>\u00a0\u00a0\u00a0\u00a0# JkUnMount \/ *. Jpg loadbalancer<br \/>\u00a0\u00a0\u00a0\u00a0# JkUnMount \/ *. Gif loadbalancer<br \/>\u00a0\u00a0\u00a0\u00a0# JkUnMount \/ *. Swf loadbalancer<br \/>\u00a0\u00a0\u00a0\u00a0# JkUnMount \/ *. Bmp loadbalancer<br \/>\u00a0\u00a0\u00a0\u00a0# JkUnMount \/ *. Png loadbalancer<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0Establish worker.properties content is as follows:<br \/>The Xml code Favorites code<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0# Worker.list = loadbalancer, server105, server106<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\u00a0\u00a0\u00a0\u00a0worker.list = worker1<br \/>\u00a0\u00a0\u00a0\u00a0# Set properties for worker1<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\u00a0\u00a0\u00a0\u00a0worker.worker1.type = ajp13<br \/>\u00a0\u00a0\u00a0\u00a0worker.worker1.host = localhost<br \/>\u00a0\u00a0\u00a0\u00a0worker.worker1.port = 8009<br \/>\u00a0\u00a0\u00a0\u00a0worker.worker1.lbfactor = 50<br \/>\u00a0\u00a0\u00a0\u00a0worker.worker1.cachesize = 10<br \/>\u00a0\u00a0\u00a0\u00a0worker.worker1.cache_timeout = 600<br \/>\u00a0\u00a0\u00a0\u00a0worker.worker1.socket_keepalive = 1<br \/>\u00a0\u00a0\u00a0\u00a0worker.worker1.socket_timeout = 300<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\u00a0\u00a0\u00a0\u00a0# Define the first node &#8230;<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server105.port = 9090<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server105.host = 127.0.0.1<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server105.type = ajp13<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server105.lbfactor = 1<br \/>\u00a0\u00a0\u00a0\u00a0# # Worker.server105.local_worker = 1<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server105.cachesize = 100<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\u00a0\u00a0\u00a0\u00a0# Define the 2nd node &#8230;<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server106.port = 9090<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server106.host = 127.0.0.1<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server106.type = ajp13<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server106.lbfactor = 1<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server106.local_worker = 1<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.server106.cachesize = 100<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\u00a0\u00a0\u00a0\u00a0# Now we define the load-balancing behaviour<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.loadbalancer.type = lb<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.loadbalancer.balanced_workers = server105, server106<br \/>\u00a0\u00a0\u00a0\u00a0# Worker.loadbalancer.sticky_session = 1<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<br \/>\u00a0\u00a0\u00a0Finally, you need to join in httpd.conf:<\/p>\n<p>The Xml code Favorites code<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0Include conf\/mod_jk2.conf<\/p>\n<p>\u00a0<br \/>\u00a0\u00a0\u00a0\u00a0At 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<br \/>\u00a0\u00a0\u00a0\u00a0Can then be compiled to generate:<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>The Xml code Favorites code<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0# Tar xzvf jakarta-tomcat-connectors-jk-1.2.6-src.tar.tar<br \/>\u00a0\u00a0\u00a0\u00a0# Cd jakarta-tomcat-connectors-jk-1.2.6-src\/jk\/native<br \/>\u00a0\u00a0\u00a0\u00a0#. \/ Configure &#8211; with-apxs = \/ usr\/local\/apache2\/bin\/apxs<br \/>\u00a0\u00a0\u00a0\u00a0# Make<br \/>\u00a0\u00a0\u00a0\u00a0# Cp .\/apache-2.0\/mod_jk.so \/ usr\/local\/apache2\/modules \/<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0Configured 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.<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0To done here, to engage in a war package, which is simple to get hold of jsp files, source code such as:<br \/>The Html code Favorites code<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0Hello ~ ~ ~ ~<br \/>\u00a0\u00a0\u00a0\u00a0Image: &lt;img src=&#8221;10.jpg&#8221;\/&gt;<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0\u00a0War on jboss default \/ deploy directory, start jboss and apache jsp files through apache port access war package to try it! ~ ~<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0Then 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?<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0\u00a0Corresponding VirtualHost httpd.con plus RewriteRule ^ \/ the WebTest \/ (*) html \/ $ 1.html [R, NE], such access will jump up.<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0\u00a0The 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];<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0\u00a0Complete httpd.conf VirtualHost configuration:<br \/>The Xml code Favorites code<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0&lt;VirtualHost *&gt;<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ServerAdmin sefer@xiaofeng.com<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0DocumentRoot \/ usr\/local\/apache2\/htdocs\/sefer<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ServerName www.test.com<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ErrorLog logs \/ test.sefer.com-error_log<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0TransferLog logs \/ test.sefer.com-access_log<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0RewriteEngine On<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0RewriteRule \/ test \/ (. *) \/ Index.html [R, NE]<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0RewriteRule \/ out \/ (. *) Http:\/\/www.163.com [R, NE]<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0RewriteRule ^ \/ WebTest \/ (. *). Html \/ $ 1.html [R, NE]<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0RewriteRule ^ \/ WebTest \/ (. *). Jpg \/ $ 1.jpg [R, NE]<br \/>\u00a0\u00a0\u00a0\u00a0&lt;\/ VirtualHost&gt;<\/p>\n<p>\u00a0<\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p> First configure apache conf directory establish mod_jk.conf file, which reads as follows:<\/p>\n<p> LoadModule jk_module modules \/ mod_jk.soThe Xml code Favorites code<\/p>\n<p> 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 &#8220;[% a% b% d% H:% [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1132"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1132"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1132\/revisions"}],"predecessor-version":[{"id":1133,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1132\/revisions\/1133"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}