Okay, so I've got a couple sites enabled, say site2.com and site3.com
site2.com should direct to /var/www/site2.com
site3.com should direct to /var/www/site3.com
mydomain.com along with any wildcards (ip, another domain with A record to my ip) should direct to /var/www
Lets say mydomain.com is my site, and has a documentroot of /var/www, and uses the 'default' apache config. Site2.com and site3.com have their own config files with custom directives.
mydomain.com being the default, wildcard, catch all, should direct all unhandled requests to /var/www/
site2.com directs correctly to /var/www/site2.com
www.site2.com also, correctly directs to /var/www/site2.com
Here's where the problem arises.
site3.com erroneously directs to /var/www/site2.com
HOWEVER
www.site3.com directs correctly to /var/www/site3.com
It is this site, and this site only, that mistakenly directs to the other folder. I have tried.
Code:
rm /etc/apache2/sites-available/site3.com
cp /etc/apache2/sites-available/site2.com /etc/apache2/sites-available/site3.com
searched for all instances of 'site2.com' in the new file, and replaced it with site3.com. Complete insuring a working config from site2 replaced the config from site3, and verified that
http://site3.com continues to direct to /var/www/site2.com
I've spent about two days trying to get to the bottom of this with a user from ubuntuforums.org, and we've both come up stumped as to why this site is misbehaving.
I even went so far as to completely remove and purge apache2 from my box, and after a completely fresh install, it still doesn't work.
It is this site, and completely this site only that for some reason doesn't work.
/etc/apache2/sites-available/
default
site2.com
site3.com
/var/www/
site2.com
site3.com
index.php
default
Code:
<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
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</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>
site2.com
Code:
#
# site2.com (/etc/apache2/sites-available/site2.com)
#
<VirtualHost *>
ServerAdmin admin@site2.com
ServerName site2.com
ServerAlias www.site2.com
# Indexes + Directory Root.
Options -Indexes
DirectoryIndex index.php index.html
DocumentRoot /var/www/site2.com/
# CGI Directory
ScriptAlias /cgi-bin/ /var/www/site2.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /var/log/apache2/site2.com/error.log
CustomLog /var/log/apache2/site2.com/access.log combined
</VirtualHost>
site3.com
Code:
#
# site3.com (/etc/apache2/sites-available/site3.com)
#
<VirtualHost *>
ServerAdmin admin@site3.com
ServerName site3.com
ServerAlias www.site3.com
# Indexes + Directory Root.
Options -Indexes
DirectoryIndex index.php index.html
DocumentRoot /var/www/site3.com/
# CGI Directory
ScriptAlias /cgi-bin/ /var/www/site3.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /var/log/apache2/site3.com/error.log
CustomLog /var/log/apache2/site3.com/access.log combined
</VirtualHost>
httpd.conf is empty
ports.cong contains
Code:
NameVirtualHost *
Listen 80
Unable to post the apache2.conf due to message character limits. If anyone would like me to post that just go ahead and say so.
If anyone would like to take a look at the unedited config files, you're more than welcome to, just send me a PM and I will give you the actual website URL's and the config files.