try tail -f /var/log/apache2/error_log for viewing error when accessing example.com or you example.com error_log file. may be it will give you some idea. Basically NameVirtualHost *:80 on top of my default file. /etc/apache2/sites-available/example.com for virtual host. sudo a2ensite for enabling it. adding the information to /etc/hosts and sudo service apache2 restart did the work for me
–
sagarchaliseMar 28 '11 at 11:20

Log file doesn't exist there. Does that mean it is somewhere else or it hasn't been created because no errors were encountered?
–
AshfameMar 28 '11 at 11:28

try ls -l on /var/log/apache2 and see what files exists
–
sagarchaliseMar 28 '11 at 11:34

2 Answers
2

If it works with wget, then your server is configured properly and correctly. In all likelihood, your browser is getting name information from other sources in preference to /etc/hosts for some reason.

Firstly, check /etc/nsswitch.conf and verify that "files" is listed first under "hosts".

Secondly, check your browser configuration, and make sure you aren't using a proxy and that the browser doesn't have a separate way to resolve names separate from the system method (or if it does, that it is configured to use /etc/hosts before DNS).

Thirdly, you could set up a different RFC 2606 virtual host (e.g. mysite.example) which is known not to exist in DNS (.example is expressly prohibited), which may foil some causes of naming confusion.

So basically this is for simple php and html script if you need cgi as well you need add to Option AFAIK. So first thing you need is to make $HOME/www/example.com directory. I think the <Directory></Directory> specification are important and you don't have that.