Https from Apache to JBoss
From Initq
This article will show step my step how to get Apache SSL to forward all traffic to JBoss and have a secure packet transfer.
Contents |
JBoss Setup
We are assuming that JBoss is all set up and you also have your application running on port 8080 which the default port for JBoss.
Set up Apache
Download Apache from http://httpd.apache.org/download.cgi and test the server by going to the main page from a different machine to make sure Apache is all working.
Generate SSL certs
Below commands will gererate the key files, then you will need the csr file and then we will create the actual certificate. The last command removes the pass phrase from the key.
openssl genrsa -des3 -out dominion.key 4096 openssl req config openssl.cnf -new -key dominion.key -out dominion.csr openssl x509 -req -days 365 -in dominion.csr -signkey dominion.key -out dominion.crt openssl rsa -in dominion.key -out dominion.key.insecure
Copy all these 4 files into Apache/conf/certs directory.
Enable Modules in httpd.conf
Uncomment the below modules.
Listen 443 LoadModule ssl_module modules/mod_ssl.so LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_ftp_module modules/mod_proxy_ftp.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule setenvif_module modules/mod_setenvif.so Include conf/extra/httpd-vhosts.conf
Add the following in the httpd-vhosts.conf file
Delete the original file that came with Apache and replace it with the following httpd-vhosts.conf file.
<VirtualHost *:80> ServerName dominion.apptricity.com:80 ProxyPreserveHost On ProxyPass / http://192.168.168.19:8080/ ProxyPassReverse / http://192.168.168.19:8080/ </VirtualHost> <VirtualHost *:443> ServerName dominion.apptricity.com:443 SSLEngine On SSLCertificateFile "C:\Program Files\Apache Software Foundation\Apache2.2\conf\certs\dominion.crt" SSLCertificateKeyFile "C:\Program Files\Apache Software Foundation\Apache2.2\conf\certs\dominion.key.insecure" ProxyPreserveHost On ProxyPass / http://192.168.168.19:8080/ ProxyPassReverse / http://192.168.168.19:8080/ </VirtualHost>
Edit JBoss Root Doc file
This file is located at
- jboss-4.2.3\server\default\deploy\jboss-web.deployer\ROOT.war
Move the old index.html file to Index2.html and create a index.html file with the following in it.
<html> <body> </body> <script> document.location.href = 'https://dominion.apptricity.com/public_html/controller'; </script> </html>
