Integrate Jboss in Apache virtualhost using jk_module
Posted by John Paul van Helvoort on April 23, 2009
Some time ago i had to integrate a JBOSS server in an apache configuration using a virtualhost setup.
This was due the fact that the server was hosting more configurations and there for needed to be adjusted in using virtual host setup as this is the best way of organizing your site.
First create a configuration file called /etc/apache2/mod-jk.conf :
LoadModule jk_module /usr/lib/apache2/mod_jk.so
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkShmFile logs/jk.shm
<Location /jkstatus/>
JkMount status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
After this we need to create a /etc/apache2/worker.properties file:
worker.list= production,status workder.production.type=ajp13 workder.production.host=apps01 workder.production.port=8009 workder.production.socket_timeout=120 worker.status.type=status
When these configuration files are in place , we can implement them by including the mod-jk-conf in the httpd.conf confguration file.
( when not already done so )
# Include jboss Include /etc/apache2/mod-jk.conf # Include virtualhosts Include /etc/apache2/vhosts.d/*.conf
Now we can call our jkMount from within our Virtualhost configuration vhost_443.conf
<Virtualhost *:443> ServerName support.example.com ServerAdmin webmaster@example.com ############################################## # SSL Config ############################################## SSLEngine On AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl .crl SSLProtocol -all +TLSv1 +SSLv3 SSLCipherSuite HIGH:MEDIUM:!aNULL:+SHA1:+MD5:+HIGH:+MEDIUM SSLVerifyClient none SSLProxyEngine off ############################################## # Orginal Certificate for support.example.com ############################################## SSLCertificateFile /etc/apache2/ssl.crt/support_example_com.crt SSLCACertificateFile /etc/apache2/ssl.crt/support_example_com.ca-bundle SSLCertificateKeyFile /etc/apache2/ssl.key/support_example_server.key.nopassword ############################################## ErrorLog /var/log/apache2/support_example_ssl_.error.log CustomLog /var/log/apache2/support_example_ssl_.access.log combined ################################################### # "Unknown" Error in IE -> SSL closed # ################################################### SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0 ################################################### ################################################### # jboss integration virtualhost ################################################### JkMount /* production </Virtualhost>
For redirecting http traffic to use the https for the requested domain , simply add another virtualhost config containing :
################################################################## # http://support.example.com ################################################################## <VirtualHost *:80> ServerAdmin webmaster@example.com ServerName support.example.com ErrorLog /var/log/apache2/support.example.com_redirect_error.log CustomLog /var/log/apache2/support.example.com_redirect_access.log combined RedirectPermanent / https://support.example.com/ </VirtualHost>
Don’t forget to restart your apache configuration !

John Hallas said
Hi John, a colleague just mentioned your site and how it had helped him with an OMS issue.
I was wondering how you format your content on the blog. I also run a wordpress blog but I do struggle to get the formatting correct.
You have 2 different styles, one in this entry which looks like a screenshot of a numbered page and the other which is a boxed layout. How do you achieve these
Thanks
John
John Paul van Helvoort said
Hi John,
Yes indeed this was a challange as well :).
Instead of using
, i use
for displaying codes.
Hope this helps !
Regards,
John
John Hallas said
That helps a lot John. The lang=xml displays the numbered page, what do you use to layout the boxed code entries in your blog.
PS Your site is quite interesting and I know it was a big help to Simon who put the right keywords into Google and yours was the only hit.
John Paul van Helvoort said
Hi John,
When no special symbols need to be displayed , i just use the standard “code” as mentioned in the previous post.
Thanks for your feedback !
Regards,
John