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.

I am using ProxyPass and ProxyPassReverse directives for redirecting all requests from Tomcat's application (from port 8080) to subdomain (port 80). In addition I have default php website on port 80. So the config looks like:

<VirtualHost xx.xx.xx.xx:80 >
    ServerName domain.com
    DocumentRoot /var/www/site
</VirtualHost>
<VirtualHost xx.xx.xx.xx:80 >
    ServerName sub.domain.com
    ProxyRequests Off
    ProxyPreserveHost On
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
</VirtualHost>

Now I have to add a SSL support so I added the following lines into config:

NameVirtualHost *:443
<VirtualHost _default_:443>
    SSLEngine on
    SSLCertificateFile /usr/local/ssl/crt/public.crt
    SSLCertificateKeyFile /usr/local/ssl/private/private.key
    SSLCACertificateFile /usr/local/ssl/crt/intermediate.crt
    ServerName domain.com:443
    DocumentRoot /var/www/site
</VirtualHost>

But the problem that https works fine only on root site, but when I am trying to get subdomains via https it redirects me to non-existing page... How can I configure the apache in order to implement this?

Thank you

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You haven't added an SSL (port 443) virtualHost for sub.domain.com e.g.

<VirtualHost _default_:443>
ServerName sub.domain.com

SSLEngine On
SSLCertificateFile /usr/local/ssl/crt/public.crt
SSLCertificateKeyFile /usr/local/ssl/private/private.key
SSLCACertificateFile /usr/local/ssl/crt/intermediate.crt

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

# Needed if you want to go to preserve the SSL connection all the way to tomcat,
# but not worth it as both daemons are on the same physical box.
#SSLProxyEngine On  

ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>   
share|improve this answer

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.