3

I have two virtual hosts, but apache seems to be defaulting to one of them.

Here is host #1:

<VirtualHost *>

        ServerName goiclub.com
        ServerAlias www.goiclub.com *.goiclub.com
        ServerAdmin webmaster@localhost

        DocumentRoot /home/casey/public_html/goiclub/public

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /home/casey/public_html/goiclub/public>
                DirectoryIndex index.php index.htm index.html
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>



        ErrorLog /home/casey/public_html/goiclub/log/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel debug

        CustomLog /home/casey/public_html/goiclub/log/access.log combined
        ServerSignature On

        Alias /doc/ /usr/share/doc/
        <Directory "/usr/share/doc/">
                Options Indexes MultiViews FollowSymLinks
                AllowOverride None
                Order deny,allow
                Deny from all
                Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>

</VirtualHost>

And this is the other vhost:

<VirtualHost *>
ServerAdmin [email protected]
ServerName geticlub.com
ServerAlias www.geticlub.com *.geticlub.com

DirectoryIndex index.php
DocumentRoot /home/casey/public_html/geticlub/public

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /home/casey/public_html/geticlub/public>
                DirectoryIndex index.php index.htm index.html
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

LogLevel debug
ErrorLog /home/casey/public_html/geticlub/log/error.log
CustomLog /home/casey/public_html/geticlub/log/access.log combined
</VirtualHost>

whether I type in goiclub.com or geticlub.com it returns 'geticlub.com' vhost. Does anyone know why?

Also this might be helpful:

sudo apache2ctl -t -D DUMP_VHOSTS
apache2: Could not reliably determine the server's fully qualified domain name, using 50.56.118.158 for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:*                    geticlub.com (/etc/apache2/sites-enabled/geticlub.com:1)
*:*                    goiclub.com (/etc/apache2/sites-enabled/goiclub.com:1)
1
  • are these domains present in your /etc/hosts? May 22, 2011 at 5:26

1 Answer 1

4

You need NameVirtualHost set up.

Open ports.conf and add: (You can also put it above the first <virtualHost>

NameVirtualHost *:80
Listen 80

You can also use the ip address instead of the wildcard.

Your vhost has to be formatted exactly the same as the NameVirtualHost format.

If it's formatted like this:

NameVirtualHost 1.2.3.4:8080

then vhost should be:

<VirtualHost 1.2.3.4:8080>

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .