Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I use Debian 7 and have installed a virtual host with address following this tutorial:

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

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

<VirtualHost *>
    DocumentRoot /usr/share/destfolder
    ErrorLog /var/log/apache2/
    CustomLog /var/log/apache2/ common

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

Any suggestions?

share|improve this question

1 Answer 1

Linking just the tutorial isn't enough information, the better is if you post your configuration file. The thing you end up in /var/www when opening your virtualhost address can have more causes.

Apache configuration file is built the way that without context, the directives are applied globally. Otherwise they apply only within the context. The virtualhosts are done the way the default or * virtualhost is set as default. If there is none such, the first virtualhost encountered while parsing the config is taken as default.

Now, finally, to the possible answer:

1) In your virtualhost you have not set the DocumentRoot directive and the (presumably default) global DocumentRoot is pointing to the /var/www.

2) Your virtualhost is not working in the way you expect. This sometimes happens when you make a mistake in naming. With LogLevel debug enable the debug logging and watch what happens and which virtual host is called when you open the desired address. The log files on Debian are located in (not 100% sure) /var/log/apache2/.

Post your config files and debug messages, you greatly increase the chance of useful suggestions.

Update: Well it seems you turned on name-based virtual hosting. Basically your config looks reasonable. In the <VirtualHost ...> clause, you should specify the destination port like <VirtualHost *:443> and so.

The directives DocumentRoot and ServerName are here, it is ok. Probably your virtual host doesn't get invoked when you request the page.

This can be because the Apache doesn't know, what IP the points to. Do you have in DNS or, at least, in hosts file?

More on name-based virtual hosts:

share|improve this answer
Here is the file contents of the file named "", located at /etc/apache2/sites-available: <VirtualHost *> ServerName DocumentRoot /usr/share/destfolder ServerAdmin ErrorLog /var/log/apache2/ CustomLog /var/log/apache2/ common </VirtualHost> – barakuda28 Sep 23 '13 at 12:25
update to answer – Fiisch Sep 24 '13 at 18:15

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.