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?

  • 1
    it should be <VirtualHost *:80> not <VirtualHost *> – Rahul Patil Sep 23 '13 at 12:36
  • @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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.