Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hello firstly apologies if this is a daft question - I am new to this stuff and very, very stuck. I can't find an existing post that solves my problem.

I am trying to reverse proxy an SSL URL to a Tomcat app. When using http, the config shown below works ok. Under https, it doesn't. What I want to achieve is https --> Apache2.2 - http -> Tomcat6

Its a virtual domain and the only options I seem to have to configure Apache are confined to an include file (below) that is pulled into httpd.conf.

The Directory part was there by default, the content after that was added by me.

<Directory /var/www/vhosts/<domain>/httpdocs/>
php_admin_value open_basedir "/var/www/vhosts/<domain>/httpdocs:/tmp:/:.:../../:../../../:.."
</Directory>

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadFile /usr/lib/libxml2.so.2.7.6
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
LoadModule proxy_connect_module /usr/lib/apache2/modules/mod_proxy_connect.so
LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so
SSLProxyEngine on
ProxyPass /app1/ ajp<link removed 127.0.0.1:8009/app1/>
ProxyPass /app2/ ajp<link removed 127.0.0.1:8009/app2/>
ProxyPassReverse /app1 ajp<link removed 127.0.0.1:8009/app1/>
ProxyPassReverse /app2/ ajp<link removed 127.0.0.1:8009/app2/>

Accessing http://mydomain.com/app1/login/do/ etc works fine. https://mydomain.com/app1/login/do/ produces a 404 error. The server logs state that /var/www/vhosts//app1 does not exist.

I can't understand why the config is trying to locate this file, rather than point to the Tomcat app.

This is getting a bit urgent, so any advice would be very welcome.

Cheers George

share|improve this question

1 Answer 1

Seems that your proxy config is not in context for the SSL listener; you'd expect the ProxyPass to be encountered and that would be it, but instead, it's trying to serve a document under the DocumentRoot for the SSL listener (which seems to be /var/www/vhosts//).

The fix should be to just add those ProxyPass(Reverse) lines to the 443 VirtualHost. But, to verify exactly what's going on we would need more of the config - sounds like a shared hosting environment so you may not be able to get at this info, but in all likelihood it's an issue with the config not applying to the 443 VirtualHost.

If you have any more config in your included file (specifically, the VirtualHost block), or any access to the file that's including that file, then it should be an easy fix. Otherwise, you may be stuck pestering someone to include a file in your port 443 config in the same way they're including one in your port 80 config.

share|improve this answer
    
Thanks Shane, that makes perfect sense. I have since found a further config include file that is pulled into the VirtualHost :443 block. I'll stick the directives in there and give it a go. Thank you for taking the time to help - it is very much appreciated. –  GeorgeB Mar 8 '11 at 15:27
    
Shane - just to follow up - your solution worked a treat. Thanks again for your help. Cheers, George. –  GeorgeB Mar 8 '11 at 22:46
    
@GeorgeB Good to hear. –  Shane Madden Mar 8 '11 at 22:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.