Integrate Jboss in Apache virtualhost using jk_module

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 JkMount status Order deny,allow Deny from all Allow from 127.0.0.1

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

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

For redirecting http traffic to use the https for the requested domain , simply add another virtualhost config containing :

################################################################## # http://support.example.com ################################################################## 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/

Don’t forget to restart your apache configuration !

Comments are closed.

  • 071 - 82 000 82
  • Rijndijk 137 | 2394 AG Hazerswoude-Rijndijk
DEMO
Oracle Specialized
Java
GlassFish
WSO2
i-bridge
Rabobank
Greencat
Reuma Revalidatie Rotterdam
Robeco
VU Medisch Centrum
CHS
LUMC
TomTom
TKP
NCCW
Erasmus MC
UMCG
VIR
ANWB
BVA Auctions
D-Reizen
STEDIN