Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I setup a subdomain in my sites-available folder, enabled it and done everything needed so that it restarts apache2 with no errors (changing default:443 to *:443, adding NameVirtualHost *:443 to ports.conf, etc).

The subdomain now works perfectly but when I try to access any page using SSL on the main domain it jumps to my error page. It seems to have taken over all SSL.


Apache2 error: File does not exist: /var/www/subdomain/foldername

It should not be reading from the subdomain folder for this. My guess is it is a problem in my virtual host setup below:

    <VirtualHost *:443>
    VirtualDocumentRoot /var/www/subdomain/
    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/
    SSLCertificateKeyFile /etc/apache2/ssl/
    SSLCertificateChainFile /etc/apache2/ssl/
    SSLCACertificateFile /etc/apache2/ssl/bundle.crt
    SSLProtocol all
    SSLCipherSuite HIGH:MEDIUM

Results of apachectl -S:

    VirtualHost configuration:
    wildcard NameVirtualHosts and _default_ servers:
    *:443    is a NameVirtualHost
             default server (/etc/apache2/sites-enabled/
             port 443 namevhost (/etc/apache2/sites-enabled/
             port 443 namevhost * (/etc/apache2/sites-enabled/default-ssl:2)
    *:80     is a NameVirtualHost
             default server production1 (/etc/apache2/sites-enabled/000-default:1)
             port 80 namevhost production1 (/etc/apache2/sites-enabled/000-default:1)
    Syntax OK
share|improve this question
Can you provide the output from apachectl -S? – Shane Madden Jul 15 '13 at 5:47
Added to question. – codephobia Jul 15 '13 at 5:54
up vote 2 down vote accepted

SSL virtual host configurations are just like normal ones; they don't inherit directives from the corresponding non-SSL vhost configurations or anything.

Since you have specified the directive VirtualDocumentRoot /var/www/subdomain/, apache will use this folder for all the requests which match this vhost (eg. for You should change this to the actual location you'd like it to use for the webroot.

Also, one point: you don't need to specify a name in ServerAlias if it's the ServerName.

That you are using wildcard SSL isn't particularly relevant to this problem.

Also, ensure that each site you have has its own SSL virtualhost configuration parallel with the cleartext one. Be aware that the default vhost for port 443 (the first one on the search path in alphabetical order) will be used if the client doesn't support SNI but is using SSL.

Looking at your apachectl -S output, you will need to do a few things:

  • Rename your default SSL vhost config file so that it is alphabetically before all others
  • Remove the wildcard ServerName or ServerAlias from the default SSL vhost and replace it with (and if you like). It will match all unmatched subdomains by virtue of being the default; the wildcard will make it match everything so that matches the default vhost too.
share|improve this answer
Yes but it is also using it for a URL like as per my confusion and the error log. – codephobia Jul 15 '13 at 5:48
Yes, I was in the middle of typing that last bit out. – Falcon Momot Jul 15 '13 at 5:49
That has fixed it. Thanks! – codephobia Jul 15 '13 at 6:09

Your Answer


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.