DeveloperSide.NET Forums
July 06, 2020, 05:12:59 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: setting up 2 ssl sites w/ 1 ip?  (Read 30202 times)
0 Members and 1 Guest are viewing this topic.
bob4432
Jr. Member
**
Posts: 30


View Profile Email
« on: September 12, 2008, 11:40:30 PM »

anybody know how to do this?  i know there will be errors w/ the certfiicate, but that is ok, it is for friiends.  there is some sensitive data i need to move (medical) and i would like to set up a 2nd ssl site.  i can use a different port, but am i limited to 1 ip.

thanks in advance,
bob
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #1 on: September 13, 2008, 12:15:24 AM »

It's an intresting concept.

SSL happens before the HTTP host headers are transmited which identify the VirtualHost/domain the request is going to, so most people will tell you it can't be done...

Your only option is to configure the VirtualHost with...
ServerName domain1.com
ServerAlias domain2.com
DocumentRoot C:/www/vhosts/domain/

And contain both sites under one VH... You'll need to then use mod_rewrite to check which Host is being requested and rewrite the internal requests to something like C:/www/vhosts/domain/1,2/

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} domain1.com$ [NC]
RewriteRule ^/*(.*)$ /1/$1 [L]

RewriteCond %{HTTP_HOST} domain2.com$ [NC]
RewriteRule ^/*(.*)$ /2/$1 [L]

domain1.com would be C:/www/vhosts/domain/1/
domain2.com would be C:/www/vhosts/domain/2/

You could even make the cert valid by using a property called Subject Alternative Names.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
bob4432
Jr. Member
**
Posts: 30


View Profile Email
« Reply #2 on: September 13, 2008, 02:23:46 AM »

i have seen this but haven't got it working yet -

Code:
  NameVirtualHost *:443

    <VirtualHost *:443>
        ServerName www.domain.com
        SSLEngine on
        SSLCertificateFile /path/to/www.domain.com.cert
        SSLCertificateKeyFile /path/to/www.domain.com.key

        DocumentRoot /www/vhosts/domain.com
   </VirtualHost>
   
   <VirtualHost *:443>
        ServerName www.domain.org
        SSLEngine on
        SSLCertificateFile /path/to/www.domain.com.cert
        SSLCertificateKeyFile /path/to/www.domain.com.key

        DocumentRoot /www/vhosts/domain.org
   </VirtualHost>

and also this using different ports -

Code:
   <VirtualHost _default_:443>
        ServerName www.domain.com
        SSLEngine on
        SSLCertificateFile /path/to/www.domain.com.cert
        SSLCertificateKeyFile /path/to/www.domain.com.key

        DocumentRoot /www/vhosts/domain.com
   </VirtualHost>
   
   <VirtualHost _default_:444>
        ServerName www.domain.org
        SSLEngine on
        SSLCertificateFile /path/to/www.domain.org.cert
        SSLCertificateKeyFile /path/to/www.domain.org.key

        DocumentRoot /www/vhosts/domain.org
   </VirtualHost>
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #3 on: September 13, 2008, 02:04:18 PM »

The 1st example you posted will not work as SSL Virtual Hosts have nothing to do with Name based Virtual Hosts.

On the 2nd example '_default_', in this case, means any IP not yet picked up by another VirtualHost... Your 1st '_default_' Virtual Host will always be used. You need to get rid of the _default_ in both blocks and use your IP address.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
bob4432
Jr. Member
**
Posts: 30


View Profile Email
« Reply #4 on: September 13, 2008, 04:50:30 PM »

The 1st example you posted will not work as SSL Virtual Hosts have nothing to do with Name based Virtual Hosts.

On the 2nd example '_default_', in this case, means any IP not yet picked up by another VirtualHost... Your 1st '_default_' Virtual Host will always be used. You need to get rid of the _default_ in both blocks and use your IP address.

would this be the local machine's ip or the external ip?
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #5 on: September 13, 2008, 11:49:10 PM »

LAN IP.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #6 on: September 13, 2008, 11:52:33 PM »

On second thought, since you are using different port #s, it might work with _default_. But you still might need a bit more info in that VH block, such as directory permissions. And you should make sure you do not have 'NameVirtualHost */IP:443' anywhere in the configuration.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
bob4432
Jr. Member
**
Posts: 30


View Profile Email
« Reply #7 on: September 14, 2008, 12:51:41 AM »

thanks for the info.  i was going to try it out w/ the basic setup you give us in the suite for the ssl vhosts.  i tried it once and for some reason it took me to my 1st host even though i put in the address for the 2nd, but it at least got me to my machine :)
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #8 on: September 14, 2008, 02:10:16 AM »

For that 2nd one you will need to enter URL https://example.com:444/ as you are using a port other than the default SSL which is 443.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!