I am trying to setup my dev machine with virtual hosts so I can access my development projects with a simple url, like http:// project.dev/ rather that a whole http:// 127.0.0.1/dev/path/to/root/of/project/ type of url.
Now, I'm aware there are many tutorials and questions already answered about this, but after trying many of them, I feel like I'm running in circles here.
The problem is simple: after setting up my hosts file and my virtual hosts, any attempt to access a virtual hosts irremediably displays the content of my server DocumentRoot.
my hosts file:
127.0.0.1 localhost 127.0.0.1 mydomain.dev 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost
NameVirtualHost *:80 <VirtualHost *:80> ServerName localhost DocumentRoot /Users/pilot/Sites/ </Virtualhost> <VirtualHost *:80> ServerName mydomain.dev DocumentRoot /Users/pilot/Sites/devel/vytamin/dev/ </VirtualHost>
I precise that the httpd-vhosts.conf file IS loaded in my httpd.conf and I do get a warning if I point the virtual host document root to a wrong folder.
I made a try setting the localhost virtual host to the following, without any success.
<VirtualHost *:80> ServerName localhost DocumentRoot /Users/pilot/Sites/devel </Virtualhost>
The following URLS all display the DocumentRoot of my server defined in my httpd.conf file, and seem to ignore the DocumentRoot defined in my VirtualHosts.
http:// 127.0.0.1/ http:// localhost/ http:// mydomain.dev/
I'm running Apache2.2 on Mac OSX 10.5 Leopard, but not the one shipped with mac os. I compiled my own under /usr/local/apache2 and web sharing IS disabled
I can't see anything wrong with my set up so I hope the community will! Thanks for your help!