Page 1 of 1

Apache with SSL as Tomcat Frontend

PostPosted: Sun Aug 14, 2011 2:56 pm
by Megamorf
Setup:
- Ubuntu 10.04 x64
- Tomcat 6
- Apache 2.2

Everything is running on one host. The communiction so far looks like this:

[Apache] <-ajp-> [Tomcat]


I configured Apache to use a reverse proxy to communicate with the Tomcat.

Apache:

httpd.conf wrote:
ServerName localhost

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module /usr/lib/apache2/modules/mod_proxy_balancer.so


ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /subsonic ajp://localhost:8009/subsonic
ProxyPassReverse /subsonic ajp://localhost:8009/subsonic



Tomcat

server.xml wrote:<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>


I can access the server through http://<apache>/subsonic but I want to use the apache to send the Subsonic http traffic over ssl.
Therefore, I created a self-signed ssl certificate (cert.pem, key.pem) with tinyca and put both in the /etc/apache2/ssl directory.

I put the following in the /etc/apache2/sites-available directory and put a link to the file into the sites-enabled directory.
I read that in some tutorial, but I am not sure if this is really the correct way to do it:

<domainname>-file wrote:<VirtualHost *:443>
ServerName <domain.tld>
SSLEngine on
SSLCertificateKeyFile /etc/apache2/ssl/key.pem
SSLCertificateFile /etc/apache2/ssl/cert.pem

ServerAdmin root@localhost
ServerName localhost
DocumentRoot /var/www/

</VirtualHost>



How can I achieve that Apache's proxy directory is served through https.

Thanks in advance. :-)