I probably have something set up wrong. Seems I always have problems trying to configure my Virtual Hosts correctly.
I'm getting this error after restarting Apache:
Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Wed Oct 14 17:39:17 2009] [warn] VirtualHost site1.local:0 overlaps with VirtualHost site2.local:0, the first has precedence, perhaps you need a NameVirtualHost directive
Why is it using 127.0.1.1 for ServerName? And why isn't my site2.local virtual host working?
Here's my hosts file:
# /etc/hosts
127.0.0.1 localhost site1.local site2.local
127.0.1.1 andrew-laptop
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
In /etc/apache2/sites-available I have 3 files: default, site1.local, and site2.local
default:
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
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 /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/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>
site1.local:
<VirtualHost site1.local>
ServerAdmin webmaster@localhost
ServerName admin
DocumentRoot /home/andrew/Projects/site1/public
CustomLog /var/log/apache2/site1-access.log combined
<Directory /home/andrew/Projects/site1/public>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
site2.local:
<VirtualHost site2.local>
ServerAdmin webmaster@localhost
ServerName admin
DocumentRoot /home/andrew/Projects/site2/public
CustomLog /var/log/apache2/site2-access.log combined
<Directory /home/andrew/Projects/site2/public>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
If any of this seems wrong, please let me know. Please help me figure out what is wrong with my setup.