I have been searching and reconfiguring for 6 days now and have lost several clumps of hair.

PROBLEM:

I want 2+ virtual hosts on my ubuntu server (1 ip) BUT - Only the first "alphabetically" listed sites-enabled shows. 000-default
www.domain1.com
www.domain2.com

Individually they all work (if i a2dissite for each leaving 1)

CONFIG: - UBUNTU 10.10 Server - EC2 instance (dont shoot me for this part - hoping this isnt the issue!) - APACHE 2.2.16 - DNS my.domain.com - to my public ec2 dns (this works)

Virtual Hosts: # default

<VirtualHost *:80>
        DocumentRoot "/home/www/"
        <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Satisfy all
        </Directory>
        <Directory /home/www>
        Options Indexes Multiviews FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all
        </Directory>
        LogLevel debug
        ErrorLog /home/www/logs/error.log
        CustomLog /home/www/logs/access.log "combined"
</VirtualHost>

Virtual Host 1 - domain1

<VirtualHost *:80>
        ServerAdmin webmaster@domain1.com
        ServerName domain1.com
        ServerAlias domain1.com www.domain1.com
        # Indexes + Directory Root.
        DirectoryIndex index.php
        DocumentRoot "/home/www/www.domain1.com/"
        # Directory directive
        <Directory "/home/www/www.domain1.com">
                Options Indexes Multiviews FollowSymLinks
                AllowOverride none
                Order allow,deny
                Allow from all
        </Directory>
        # CGI Directory
        ScriptAlias /cgi-bin/ /home/www/www.domain1.com/cgi-bin
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>
        # Logfiles
        LogLevel debug
        ErrorLog "/home/www/www.domain1.com/logs/error.log"
        CustomLog "/home/www/www.domain1.com/logs/access.log" combined
</VirtualHost>

I also have the above for domain2 in another document root with a different domain name

sym links are in place. apache2ctl -St shows the following -

VirtualHost configuration:
*:80       is a NameVirtualHost
         default server  (/etc/apache2/sites-enabled/000-default:4)
         port 80 namevhost  (/etc/apache2/sites-enabled/000-default:4)
         port 80 namevhost domain1.com (/etc/apache2/sites-enabled/www.domain1.com:4)
         port 80 namevhost www.domain2.com (/etc/apache2/sites-enabled/www.domain2.com:4)
Syntax OK

My ports.conf:

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    NameVirtualHost *.443
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

No changes from default to my apache2.conf and httpd.conf is empty.

I have tried the following (and about a hundred others):

It seems I have tried everything that everyone else is having issues with but nothing seems to fix mine.

Possibilities:

  1. EC2
  2. Permissions on the files - I changed everything to the apache2 user "www-data" - no dice.
  3. I am a dope...lets hope its that and one of you kind people point me to my issue. :)
link|improve this question
feedback

2 Answers

Is it possible that your ports.conf is failing due to the period used instead of colon?

<IfModule mod_ssl.c>
    NameVirtualHost *.443
    Listen 443
</IfModule>

Note the *.443 should be *:443 above.

link|improve this answer
Also, put a "ServerName" directive in the default host. It will still be the default as it is the first one loaded. – Frands Hansen May 20 '11 at 11:37
what server name should I use? – user762313 May 20 '11 at 12:40
Fixed the : . issue, didnt fix anything tho. Cheers anyway. – user762313 May 20 '11 at 12:41
feedback

Just guessing. Looking on result of apache2ctl -St, you have difference in output :

port 80 namevhost domain1.com 
port 80 namevhost www.domain2.com

Maybe you should also set domain2.com as ServerName (without "www" prefix)

link|improve this answer
nope, fixed that piece but no dice. Thanks for taking the time anyway. – user762313 May 20 '11 at 12:40
Looks like it might be DNS related. Trying a fix now...lets see what happens when the caches clear themselves! – user762313 May 20 '11 at 14:33
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.