0

having difficulties setting multiple domains

when I sudo a2ensite example2, it doesn't load regardless of whether exampe1 is enabled or disabled...and of course takes down example1 with itself . Here are the two files(example2 is a based on example1)

in sites-available I have example1 file

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  ServerName example1.com
  ServerAlias example1.com

  DocumentRoot /var/www/example1
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>
  <Directory /var/www/example1/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>

  ErrorLog /home/ubuntu/www/logs/example1/error.log

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

  CustomLog /home/ubuntu/www/logs/example1/access.log combined

    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 example2 file

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  ServerName example2.com
  ServerAlias example2.com

  DocumentRoot /var/www/example2
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>
  <Directory /var/www/example2/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>

  ErrorLog /home/ubuntu/www/logs/example2/error.log

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

  CustomLog /home/ubuntu/www/logs/example2/access.log combined

    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>

I got

NameVirtualHost *:80

in ports.conf

What am I missing?

Jacob
  • 9,204
  • 4
  • 45
  • 56
dobata
  • 3
  • 1

1 Answers1

2

You've really over complicated your configs. First of all. Look into http://httpd.apache.org/docs/2.0/vhosts/examples.html

Then, trim down those files to the bare minimum. Make sure to activate the sites and ensure the directories exist. That should do the trick. Also, don't forget to reload apache after all of that.

Publiccert
  • 1,112
  • 1
  • 8
  • 22
  • Surely there many different templates, but I'm using the defaults since they worked great with single site. But is there actually something wrong with these ? – dobata Feb 26 '12 at 17:40
  • 1
    There isn't anything obvious wrong with them. They're just overly complicated. It's usually advisable to start with a simple vhost and build it out as you need to. Focus on getting the sites working, then adding all those 'new-fangled' functions to it. – Publiccert Feb 26 '12 at 17:44
  • yep taking to the bare essentials ServerAdmin, ServerAdmin, ServerAdmin and DocumentRoot worked out. – dobata Feb 26 '12 at 19:11
  • Glad to hear it. Just scale up your configs now and see what wasn't working. Also, check your logs for some signs. – Publiccert Feb 26 '12 at 19:25