Enable SSL for Apache Httpd - Tomcat
Follow the steps below to achieve ssl (or https):
- Enable ssl module on apache : sudo a2enmod ssl (the ssl mod config is usually located @ /etc/apache2/mods-available)
- Edit the /etc/apache2/sites-available/default-ssl file. Add the following lines:
- ProxyPass /payment ajp://<your website url>/<sub folder to redirect> (e.g. ajp://anant.apnapaisa.com/payment)
- ProxyPassReverse /payment ajp://<your website url>/<sub folder to redirect> )e.g. ajp://anant.apnapaisa.com/payment)
- Add the below lines to enable images, scripts and styles to be served via https.
- Alias /<path to scripts> /<Complete path to scripts> (e.g. /scripts /home/anant/code/tomcat/webapps/als/scripts)
- Alias /<path to styles>/style /<Complete path to sty;es> (e.g. /home/anant/code/tomcat/webapps/als/style)
- Alias /<path to images> /<Complete path to imagess> (e.g. /images/ /home/anant/code/tomcat/webapps/als/images/)
- Save the file and enable the default-site: sudo a2ensite default-ssl
- Try running https://localhost. Ignore the security warning your browser displays (if it displays any). You should reach the "It Works" page.
- In your tomcat conf/server.xml, uncomment the line:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" />
You should now be able to direct https request to your servlets deployed on tomcat.
Note: The proxy settings are for ajp connector. Use the appropriate protocol for http connector.