localhost not going to desired VirtualHost

Posted by ladaghini on Stack Overflow See other posts from Stack Overflow or by ladaghini
Published on 2010-04-28T01:19:29Z Indexed on 2010/04/28 1:23 UTC
Read the original article Hit count: 350

I have several VirtalHosts set up on my computer. I'd like to visit the site I'm currently working on from a different PC using the my comp's ip address, but every config i've tried keeps taking me to a different virtual host (in fact the first virtualhost I set up on my comp). How do I set up the apache virtualhost configs to ensure that the ip address takes me to the site I want it to.

/etc/apache2/sites-available/site-i-want-to-show-up-with-ip-address.conf contains:

<VirtualHost *:80>
ServerAdmin webmaster@localhost

ServerAlias currentsite.com

DocumentRoot /path/to/root/of/site-i-want-to-show-up
ServerName localhost

ScriptAlias /awstats/ /usr/lib/cgi-bin/

CustomLog /var/log/apache2/current-site-access.log combined
</VirtualHost>

And /etc/apache2/sites-available/site-that-keeps-showing-up.conf contains:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerAlias theothersite.com
    DocumentRoot /path/to/it
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

</VirtualHost>

I'd appreciate anyone's help.

Also, I don't know too much about configuring web servers, and I used tutorials to get the above code.

© Stack Overflow or respective owner

Related posts about apache2

Related posts about virtualhost