LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   apache2 vhost site makes default site inaccessible (https://www.linuxquestions.org/questions/linux-server-73/apache2-vhost-site-makes-default-site-inaccessible-520286/)

jyamada1 01-17-2007 05:02 PM

apache2 vhost site makes default site inaccessible
 
i'm trying to setup a local LAMP development environment. i had apache2, php5, mysql5, and phpmyadmin up and running.

i tried adding a virtualhost entry to point to a development folder, though, and now localhost is directed to that folder instead of /var/www. (i'm using the updated sites-available, sites-enabled virtualhost config).

is there something i should have changed in the default site config in sites-available to make sure only dev.mysite.com and www.dev.mysite.com address are routed to the alternative DocRoot? i want to keep /var/www as the root for localhost addresses. hope thats clear. thanks!

here are the contents of the new conf file in sites-available:
Code:

<VirtualHost dev.mysite.com>
        ServerAdmin webmaster@localhost
        ServerName dev.mysite.com
        ServerAlias www.dev.mysite.com
        DocumentRoot /home/myname/wwwdev/mysite.com/
        CustomLog /var/log/apache2/mysite.com-access.log combined
</VirtualHost>


gregmcavoy 01-17-2007 05:11 PM

I'm not a pro, but as I understand it, once you switch to using virtual hosts, the first virtual host you list becomes the default. Create a virtual host for what you want to be the default, then list any other virtual hosts after that.

jyamada1 01-17-2007 05:18 PM

ok, but how exactly does that work with the sites-enabled way of listing hosts? that is, in that way the "list" of hosts is a directory of symlinks and doesn't really have an order.

gregmcavoy 01-17-2007 06:06 PM

I believe they are processed in numberical/alphabetical order (which would explain why "000" begins the default). See http://www.linux.com/article.pl?sid=05/09/01/186204.

jyamada1 01-17-2007 08:42 PM

great! of course that makes a lot of sense. while the site name (which starts with 'd') is definitely after 000, it's good to know about the processing order.

the link you gave helped a lot and now i've got it working. i thought that the VirtualHost start tag should include the site name. by changing it from
Code:

<VirtualHost dev.mysite.com>
to
Code:

<VirtualHost *>
, everything started working as expected.

thanks for the help!


All times are GMT -5. The time now is 10:50 PM.