Apache 2.2 VirtualHosts localhost issues
I am trying to set up my dev machine with virtual hosts, so I can access my development projects with a simple url like http://project.dev/ and also for everything http://127.0.0.1/dev/ path / to / root / of / project / type url.
Now, I know that there are many lessons and questions that have already been answered about this, but after trying many of them I feel like I am running in circles.
The problem is simple: after configuring my hosts file and my virtual hosts, any attempt to access the virtual hosts non-stop displays the contents of my DocumentRoot server .
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
my httpd-vhosts.conf
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 know for sure that the httpd-vhosts.conf file is loaded into my httpd.conf and I get a warning if I point the virtual host document root to the wrong folder.
I have tried setting up my localhost virtual host to the next one, without any success.
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Users/pilot/Sites/devel
</Virtualhost>
The following URLs display my server's DocumentRoot 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 am running Apache2.2 on Mac OSX 10.5 Leopard, but not the one that ships with mac os. I have compiled my file under / usr / local / apache 2 and the web resource is IS disabled
I don't see anything wrong with my setup, so I hope the community will! Thank you for your help!
source to share
Ok I found the problem!
The config above is perfectly fine, it's just that my apache didn't restart properly. Neither apache_ctl graceful
nor apache_ctl restart
did it terminate all the httpd processes I had running, so it was not possible to load the changes in the config files correctly. After I killed the remaining processes and restarted apache, indeed it worked ...
Solved, but I feel stupid for finding this!
Now I have a daemon problem!
source to share