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 have both local.domain.com and lmarket.local.domain.com pointing to my localhost from etc/hosts.

The problem is that I am using XAMPP on Windows 7, and have 2 SSL VirtualHosts in my apache config, but no matter which one I access, I am taken to local.domain.com. On non-HTTPS requests all works fine, and the vhosts are basically the same.

Here is the relevant part of my vhosts:

<VirtualHost local.domain.com:443>
    DocumentRoot "C:/xampp/htdocs/local"
    ServerName local.domain.com
    ServerAdmin webmaster@localhost
    ErrorLog "logs/error.log"
    <IfModule log_config_module>
        CustomLog "logs/access.log" combined
    </IfModule>
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"
    <FilesMatch "\.(cgi|shtml|pl|asp|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory "C:/xampp/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    CustomLog "logs/ssl_request.log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

<VirtualHost lmarket.local.domain.com:443>
    DocumentRoot "C:/xampp/htdocs/lmarket.local"
    ServerName lmarket.local.domain.com
    ServerAdmin webmaster@localhost
    ErrorLog "logs/error.log"
    <IfModule log_config_module>
        CustomLog "logs/access.log" combined
    </IfModule>
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"
    <FilesMatch "\.(cgi|shtml|pl|asp|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory "C:/xampp/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    CustomLog "logs/ssl_request.log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

If I invert these blocks, then the opposite happens: local.domain.com goes to lmarket.local.domain.com. Any help would be appreciated.

share|improve this question

2 Answers 2

You probably forgot to tell apache that 127.0.0.1:443 is to be used for name based virtual hosts.

NameVirtualHost 127.0.0.1:443

Or even better

NameVirtualHost *:443

Should be added to your config before the VirtualHost sections. You must also update the VirtualHost with the address that you put for NameVirtualHost. E.g. <VirtualHost *:443>.

share|improve this answer
    
Sorry, forgot to add that part to the code. I do have NameVirtualHost *:443 at the top of the file, right after NameVirtualHost *:80 –  Eduard Luca Oct 26 '12 at 0:38
    
I updated my answer to emphasize that what I said is a "good idea" is actually very, very important :) –  chutz Oct 26 '12 at 2:25
up vote 0 down vote accepted

Duh, I found the answer... not sure why this is like this, but I've had to change:

<VirtualHost lmarket.local.domain.com:443>

to

<VirtualHost *:443>

and the same for the 2nd vhost. Hope it helps somebody.

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.