Dumb Virtualhost Question

Discussion in 'Server Operation' started by DantePasquale, Dec 15, 2009.

  1. DantePasquale

    DantePasquale HowtoForge Supporter

    Hi All,

    I have a really newbie question regarding the Apache Virtualhost directive in the /etc/apache2/sites-enabled files.

    I'm running ISPConfig3. One of my sites http://www.cocoanet.us generates the following VirtualHost directive:

    Code:
    <VirtualHost *:80>
          DocumentRoot /var/www/cocoanet.us/web
    
        ServerName cocoanet.us
        ServerAlias *.cocoanet.us
        ServerAlias dantepasquale.cocoanet.us
        ServerAdmin webmaster@cocoanet.us
        ......
    So, as I understand the documentation from Apache, this directive instructs Apache to listen on all IP addresses on port 80.

    So, my dumb question is: My other sites have the same thing, so how do we actually get to the correct Virtualhost since we don't specify the IP???

    Thanks for answering this dumb question :)
     
  2. topdog

    topdog HowtoForge Supporter

    name based virtual hosting uses the Host header that the client sides through via the request headers.

    The server chooses which site to serve based on the servername and, or the serveralias
     

Share This Page