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

I am having problems setting up SSL in Virtual Hosts. The setup works great on unsecure sites. And I want it to work with SSLEnabled sites.

My httpd-vhosts.conf is below:

    NameVirtualHost 127.0.0.1
<IfModule mod_rewrite.c>
    RewriteEngine On

    # Redirect /binDebug folder to https
    RewriteCond %{HTTPS} !=on
    RewriteCond %{REQUEST_URI} binDebug
    RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</IfModule>

        <VirtualHost localhost>
            ServerName localhost
            DocumentRoot "C:\xampp\htdocs"
            DirectoryIndex index.php index.html

            <Directory "C:\xampp\htdocs">            
                AllowOverride All
            </Directory>
        </VirtualHost>


        <VirtualHost virtual.c7beta.com>
            ServerName virtual.c7beta.com
            DocumentRoot "C:\Users\zee\Documents\Flex Builder 3\CLOUD\bin-debug"
            DirectoryIndex index.php index.html
             Alias /binDebug "C:\Users\zee\Documents\Flex Builder 3\CLOUD\bin-debug/"
            <Directory "C:\Users\zee\Documents\Flex Builder 3\CLOUD\bin-debug">
                Options Indexes FollowSymLinks Includes ExecCGI
                AllowOverride All
                Order allow,deny
                Allow from all
    #   SSLRequireSSL

            </Directory>
        </VirtualHost>

        <VirtualHost virtual.app.c7beta.com>
            ServerName virtual.app.c7beta.com
            DocumentRoot "C:\development\app_server\httpdocs"
            DirectoryIndex index.php index.html

            <Directory "C:\development\app_server\httpdocs">
                Options Indexes FollowSymLinks Includes ExecCGI
                AllowOverride All
                Order allow,deny
                Allow from all
    #   SSLRequireSSL

            </Directory>
        </VirtualHost>

        <VirtualHost virtual.s1.c7beta.com>
            ServerName virtual.s1.c7beta.com
            DocumentRoot "C:\development\storage_server\httpdocs"
            DirectoryIndex index.php index.html

            <Directory "C:\development\storage_server\httpdocs">
                Options Indexes FollowSymLinks Includes ExecCGI
                AllowOverride All
                Order allow,deny
                Allow from all
    #   SSLRequireSSL

            </Directory>
        </VirtualHost>

write not he SSLRequiesSSL is commented. Can some one check this and tell me what changes should I make to use https, just the way http was working.

I did the configuration changes as suggested by: http://robsnotebook.com/xampp-ssl-encrypt-passwords and it seems like working fine. But still when I type in with my servername.com it redirects to servername.com/xampp

Please help Zeeshan

share|improve this question

migrated from stackoverflow.com Jan 12 '10 at 23:51

This question came from our site for professional and enthusiast programmers.

    
possible duplicate of How to configure SSL for virtual host –  Zoredache Nov 16 '11 at 0:54

1 Answer 1

The SSL handshake happens before the HTTP header is sent with the host field, but the host name is present in the certificate used in the SSL handshake. To overcome that your client and server must support RFC 3546 TLS extensions and the server name indication. In the Microsoft client world, that support was introduced in IE7 on Vista. I don't know about Apache.

The "traditional" approach (pre-RFC 3546) was to have one IP address per SSL site so that the virtual hosting issues were avoided. The server name indication was introduced to overcome that problem. At the very least I would expect to see server configuration entries configuring each virtual host with its own certificate/private-key pair.

More on Apache vhosts. Looks like you need to make sure you have an appropriate version as well.

share|improve this answer

Your Answer

 
discard

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