0

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!

2 Answers 2

0

You'll also need NameVirtualHost *:443.

1

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.

1
  • Unfortunately that didn't work. I do appreciate your input though! Oct 19, 2012 at 16:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .