Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to setup a local working copy of my domain and I've modified the "domain" file within /etc/apache2/sites-available/, executed "sudo a2ensite domain" and then restarted apache and my browser is not looking locally for the domain. What step am I missing?

NameVirtualHost domain:80

<VirtualHost domain:80>
  ServerName domain
  DocumentRoot /var/www/domain.com/
</VirtualHost>

I should also point out that I am aware that the folder name has .com and the virtual host does not.

Update When I use *:80 instead of domain:80 I get the following error...

[Wed Mar 24 15:22:28 2010] [warn] NameVirtualHost *:80 has no VirtualHosts
share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Your Apache config looks OK. It seems that your server resolves domain address as the remote one. Try to add a line to your local /etc/hosts to fix this. The line should look like:

127.0.0.1  domain

If your local Apache is listening on the other network interface, replace 127.0.0.1 with the proper IP address

share|improve this answer
    
Bah! I knew I was missing something like this... you got it –  Webnet Mar 25 '10 at 13:03
add comment

This FAQ will help shed some light, I think. http://wiki.apache.org/httpd/CommonMisconfigurations.

The NameVirtualHost directive should refer to an interface (0.0.0.0, *, 192.168.0.1, etc).

Something along the lines of

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName domain
  DocumentRoot /var/www/domain.com/
</VirtualHost>

You then need to verify that domain does resolve to either the listed interface in the NameVirtualHost directive, or to the specific addresses used. If you're working from the web server you can add domain to the local hosts file for 127.0.0.1, or whatever address you used.

share|improve this answer
    
When I use that method.... I get this.... [Wed Mar 24 15:22:28 2010] [warn] NameVirtualHost *:80 has no VirtualHosts [Wed Mar 24 15:22:28 2010] [warn] NameVirtualHost *:80 has no VirtualHosts –  Webnet Mar 24 '10 at 19:22
add comment

Your Answer

 
discard

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.