You are not logged in.

#1 2011-04-22 11:05:12

awayand
Member
Registered: 2009-09-25
Posts: 398

[SOLVED] enable apache ssl to use httpS at will for any vhost

Hi,
I have enabled ssl on my apache install without a problem by including the file httpd-ssl.conf in my http.conf.

I have tested access by trying to access my phpmyadmin install by going to my site: https://example.com/phpmyadmin

However, when trying to use a vhost with https, it doesn't work, I get redirected to a default page (first configured vhost) as https.

If I modify the vhost like this, adding 443:

<VirtualHost *:80 *:443>
</VirtualHost>

I get an error "(Error code: ssl_error_rx_record_too_long)".

If I just add to the vhost config file instead like this:

NameVirtualHost *:80
NameVirtualHost *:443
SSLStrictSNIVHostCheck off

then I still only get the default site, but not my vhost site under ssl.

Any pointers on getting this to work? I want to be able to universally add an "s" to "http" for any vhost whenever I feel like it to encrypt traffic...

Thanks!

EDIT: Here's the solution I found. I disabled ssl on apache by commentingout the httpd-ssl.conf-Include directive in httpd.conf.
Then I installed stunnel and pointed it to my server key and certificate and enabling https connections to forward to port 80 on localhost.
One gotcha to look out for was to put "https: ALL" into the /etc/hosts.allow file as stunnel apparently uses this to decide whether a client can connect.

Last edited by awayand (2011-04-24 12:10:46)

Offline

#2 2011-04-22 11:42:42

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,229
Website

Re: [SOLVED] enable apache ssl to use httpS at will for any vhost

You need to config Apache to 'Listen' also on port 443. I can't check right now, but it is in some configfile for apache.

Last edited by zenlord (2011-04-22 11:43:02)

Offline

#3 2011-04-22 12:31:57

awayand
Member
Registered: 2009-09-25
Posts: 398

Re: [SOLVED] enable apache ssl to use httpS at will for any vhost

Apache is already listening on 443, otherwise it wouldn't work at all when I access https://example.com/phpmyadmin. My problem is that instead of responding by serving the requested vhost, apache serves only the default vhost page. For example, https://x.example.com, https://y.example.com, https://z.example.com all serve my default page at https://example.com instead of the corresponding vhost. Any idea as to what to configure so that apache serves the requested vhost under https?

EDIT: clarification

Last edited by awayand (2011-04-23 04:39:02)

Offline

Board footer

Powered by FluxBB