Question

first time poster, but please help. 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: my 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):

[URL="http://ubuntu-tutorials.com/2008/01/09/setting-up-name-based-virtual-hosting/"][/URL] [URL="http://httpd.apache.org/docs/2.2/rewrite/vhosts.html"]http://httpd.apache.org/docs/2.2/rewrite/vhosts.html[/URL] [URL="http://ubuntuforums.org/archive/index.php/t-1466665.html"]http://ubuntuforums.org/archive/index.php/t-1466665.html[/URL] [URL="http://flurdy.com/docs/ec2/basics/index.html"]http://flurdy.com/docs/ec2/basics/index.html[/URL] [URL="http://www.webmasterworld.com/apache/3282118.htm"]http://www.webmasterworld.com/apache/3282118.htm[/URL]

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. :)

Chat soon...ill be over here losing my hair.
Regards, Logansanoh

Was it helpful?

Solution 2

DNS was the culprit. Everything was being passed as expected in both EC2, Ubuntu and Apache. The problem was I was using URL redirect at the DNS. This is stoopid! It was so simple, I set up an ANAME instead using my public IP address for the alias (www.domain1.com) and the same for the (www.domain2.com) and it all worked perfectly. Now if i could only get TOMCAT to behave with mod_proxy i will be 100% there!!

OTHER TIPS

unfortunately Slicehost is slated to go down, but it has some good documentation on how to implement virtual hosts.
visit :
http://articles.slicehost.com/2010/5/19/apache-virtual-hosts-on-ubuntu-part-1
http://articles.slicehost.com/2010/5/19/apache-virtual-hosts-on-ubuntu-part-2

I have shifted away from slicehost but their documentation still comes very handy.

As a side note, You are probably not getting a lot of response here because this question is better suited for :
http://serverfault.com

Best of luck, let us know how what was going wrong, Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top