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 a Wildcard SSL installed on my Apache server. With the code snipplet below, the following works:

http://test.com (points to /var/www/html)
https://test.com  (points to /var/www/html)
http://s1.test.com  (points to /var/www/s1)

but https://s1.test.com does not work - it points to /var/www/html rather than /var/www/s1 - how can I get it so it points at it's own directory?

<VirtualHost *:443>
 DocumentRoot "/var/www/html"
 ServerAlias test.com *.test.com
 ServerName *.test.com
 SSLEngine on
 SSLCertificateFile /home/test/STAR_test_com.crt
 SSLCertificateKeyFile /home/test/test.key
 SSLCertificateChainFile /home/test/PositiveSSL.ca-bundle
</VirtualHost>
<VirtualHost *:443>
 ServerAlias s1.test.com *.s1.test.com
 ServerName s1.test.com
 DocumentRoot "/var/www/s1"
 SSLEngine on
 SSLCertificateFile /home/test/STAR_test_com.crt
 SSLCertificateKeyFile /home/test/test.key
 SSLCertificateChainFile /home/test/PositiveSSL.ca-bundle
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
 ServerName s1.test.com
 ServerAlias s1.test.com
 DocumentRoot "/var/www/s1/"
</VirtualHost>
<VirtualHost *:80>
 ServerName www.test.com
 ServerAlias test.com
 DocumentRoot "/var/www/html/"
</VirtualHost>

Thanks!

share|improve this question

2 Answers 2

up vote 0 down vote accepted

You'll also need NameVirtualHost *:443.

share|improve this answer

Probably, wildcard record from first virtualhost

ServerAlias test.com *.test.com

also includes s1.test.com, so when you ask for s1.test.com, first block of configuration is applied. Remove wildcards or make s1.test.com go first in config file.

share|improve this answer
    
Unfortunately that didn't work. I do appreciate your input though! –  user1062058 Oct 19 '12 at 16:34

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.