Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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 use Debian 7 and have installed a virtual host with address sub.domain.com following this tutorial: http://www.debian-administration.org/articles/412

I have enabled it, rebooted the PC but still the subdomain opens /var/www

Here is the file contents of the file named "sub.domain.com", located at /etc/apache2/sites-available/ :

<VirtualHost *>
    ServerName sub.domain.com
    DocumentRoot /usr/share/destfolder
    ServerAdmin info@domain.com
    ErrorLog /var/log/apache2/sub.domain.com-error_log
    CustomLog /var/log/apache2/sub.domain.com-access_log common

By the way when I reload apache's configuration, I get: NameVirtualHost *:80 has no VirtualHosts

Any suggestions?

share|improve this question
it should be <VirtualHost *:80> not <VirtualHost *> – Rahul Patil Sep 23 '13 at 12:36
Thanks! It worked! – barakuda28 Sep 23 '13 at 12:40
@Rahul Patil Can you post your comment as an answer? – krowe Sep 23 '13 at 14:20

In your Configuration , it should be <VirtualHost *:80> not <VirtualHost *>

To test the Apache configuration file for errors, use the following command:

apachectl configtest

If the configuration file is fine, this command will return Syntax Ok. Otherwise, it will return detailed information about the error discovered.

If you are using Redhat based OS then you can use :

httpd -t
share|improve this answer

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.