I'm trying to acheive the following:
http:// site.com -> main site (with www.site.com rewriting with no www)
https:// predeploy.site.com -> second site (password protected and SSL)
https:// site.com -> connection refused
http:// predeploy.site.com -> connection refused
The DNS for the subdomains is done with A records rather than CNAMEs, as they are apparently the preferred method for the Linode name servers. Both site.com and predeploy.site.com resolve to the same IP.
I have two vhosts set up:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName site.com
ServerAlias www.site.com
DocumentRoot /var/www/site.com
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</VirtualHost>
NameVirtualHost *:443
<VirtualHost *:443>
ServerName predeploy.site.com
DocumentRoot /var/www/predeploy.site.com
SSLEngine on
... # Basic auth and SSL stuff, which works
</VirtualHost>
The problem is that https:// site.com serves up the second site (same as https:// predeploy.site.com, and requires authentication), and http:// predeploy.site.com serves up the main site (same as http:// site.com). I believe this means the vhosts are wrong. How do I fix them?
listen hostname:80andlisten hostname:443– Ency Apr 3 '11 at 21:19