I have a web development box on my network called webdev.local, running Apache on Debian. Up to now I have been accessing the dev versions of my sites at webdev.local/site1, webdev.local/site2 etc. However, for certain reasons that aren't relevant to this question, I now need to set up a new virtual host, site1.local, to point to a particular site on the server. Here is what I've done so far. First, I created site1.local under /etc/apache2/sites-available, with the following content: <VirtualHost site1.local> ServerAdmin webmaster@localhost DocumentRoot /var/www/site1 CustomLog /var/log/apache2/site1.local.log combined </VirtualHost> Code (markup): I then ran this command to enable my site: a2ensite site1.local Code (markup): which completed successfully. I then added an entry in /etc/hosts to point fcm.local to 127.0.0.1. After restarting Apache, I mapped fcm.local to the IP of the dev box in the hosts file on my Windows machine. But when I access it, I just get the site root of webdev.local. Whenever I start Apache, I get the following error: Restarting web server: apache2[Sat Aug 27 20:20:54 2011] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Sat Aug 27 20:20:54 2011] [warn] NameVirtualHost *:80 has no VirtualHosts ... waiting [Sat Aug 27 20:20:55 2011] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Sat Aug 27 20:20:55 2011] [warn] NameVirtualHost *:80 has no VirtualHosts [/code. I don't know enough about Apache to know whether this warning has anything to do with the problem or not. I would really appreciate any help anyone could offer. I will post any relevant config files and information needed. Thanks! Code (markup):
I would try to change the virtualHost to: <VirtualHost site1.local:80> (notice the :80) or better: <VirtualHost 127.0.0.1:80> ServerName site1.local ... Second, you stated you mapped fcm.local to 127.0.0.1 while your VHost is called site1.local. You would need to map site1.local to 127.0.0.1
Thanks for the reply. I discovered the main source of the trouble, but it still isn't quite working. While following a tutorial, I had added an extra config file, conf.d/virtual.conf, with the following line: NameVirtualHost * Code (markup): But in ports.conf I already had NameVirtualHost *:80 Code (markup): So even if the individual VirtualHost agreed with the config file, the multiple config files didn't agree with each other. Once I got rid of virtual.conf, the startup errors went away. Now, if someone can help me take this across the finish line I would be most grateful. Currently, I can access site1.local using Lynx from the server itself. But my Windows box, which has site1.local mapped to the IP address of the server, shows the server's default site, not site1.local. Any ideas?
Just to follow up so no one wastes their time, it started working. I pu *:80 in the VirtualHost declaration rather than 127.0.0.1:80, but I don't know whether that made any difference or not. I think there was some kind of caching problem between my Windows box and the server. When I changed the content of the default page, that seemed to reset it and everything is now working properly.