TOMCAT5.5 WITH SSL, REDIRECT TO 443 WITH .HTACCESS ON CENTOS
Create the SSL certificate
keytool -genkey -alias tomcat -keyalg RSA -keystore /etc/tomcat.keystore
Use whatever password you like.
Set up Tomcat to use SSL port 8443
cp /etc/tomcat5.5/server.xml /etc/tomcat5.5/server.xml.bkp
vi /etc/tomcat5.5/server.xml
Add the following lines to the conf (and comment out the original connector)
<Connector protocol=”org.apache.coyote.http11.Http11Protocol”
port=”8443″ minSpareThreads=”25″ maxSpareThreads=”75″
enableLookups=”true” disableUploadTimeout=”true”
acceptCount=”100″ maxThreads=”200″
scheme=”https” secure=”true” SSLEnabled=”true”
keystoreFile=”/etc/tomcat.keystore” keystorePass=”password“
clientAuth=”false” sslProtocol=”TLS”/>
Making sure that Keystorefile is the location you specified above and keystorepass is whatever password you used
Set up the Firewall to redirect 443 traffic to 8443
/sbin/iptables -t nat -A PREROUTING -p tcp -m tcp –dport 443 -j REDIRECT –to-ports 8443