Forum Moderators: phranque
First of all a bit about my environment:
Win2K w/ Apache2.0.44 & php4.2.2
Also, my server is sitting behind self-managed firewall/router which has been configured correctly to all all inbound/outbound requests.
This whole process started as I obtained a new server. My current server houses the same os and versions of apache & php. All I am trying to do is migrate my existing web environment to a new machine that sits behind the exact firewall.
For some strange reason, my virutal hosts are not working. I have ONE IP and am using virtual hosts to handle one domain (call somedomain1.com) with about 10 subdomains and then another domain (call somedomain2.com) with 0 subdomains.
When I access the server via a browser with any of my urls, the same base site comes up for somedomain1.com. Before I go along too far, here are my entries tha matter in the httpd.conf file:
ServerName somedomain1.com:80
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"NameVirtualHost *
<VirtualHost *>
ServerAdmin admin@somedomain1.com
ServerName www.somedomain1.com
ServerAlias somedomain1.com
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
</VirtualHost>
<VirtualHost *>
ServerAdmin admin@somdomain1.com
ServerName a.somedomain1.com
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/a"
</VirtualHost>
<VirtualHost *>
ServerAdmin admin@somdomain1.com
ServerName b.somedomain1.com
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/b"
</VirtualHost>
<VirtualHost *>
ServerAdmin admin@somdomain1.com
ServerName c.somedomain1.com
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/c"
</VirtualHost>
.
.
.
<VirtualHost *>
ServerAdmin admin@somdomain1.com
ServerName i.somedomain1.com
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/i"
</VirtualHost>
<VirtualHost *>
ServerAdmin admin@somdomain1.com
ServerName j.somedomain1.com
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/j"
</VirtualHost>
<VirtualHost *>
ServerAdmin admin@somedomain2.com
ServerName www.somedomain2.com
ServerAlias somedomain2.com *.somedomain2.com
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/domain2"
</VirtualHost>
Since there are a few subdomain that include a .htaccess file which prompt the user for a username and password, I tried a few of them. Upon entering the url in the browser it asks for a uname/pword. I supply the correct values and hit enter. Then the browser attempts to load the base site somedomain1.com, but can quite do so becuase the files it are looking for aren't contained with in that subdomains root.
It seems to me that apache picks up the vhost, acquires the right home direcotry, but then attempts to load the index file for the base site of somedomain1.com.
I tried substituting my ip for the * in all the vhost entries and removing all but the major domain entries and still no luck. If anyone can give me a clue to what the heck is going on before I loose my sanity it would be greatly appreciated. Thanks in advance!
Try the IP address in namevirtualhost with port:
NameVirtualHost 10.10.10.1:80 Then, for all of your virtualhost entries, use the subdomain name with port:
<VirtualHost www.somedomain1.com:80>
ServerAdmin admin@somedomain1.com
ServerName www.somedomain1.com
ServerAlias somedomain1.com
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
</VirtualHost>
<VirtualHost a.somedomain1.com:80>
ServerAdmin admin@somdomain1.com
ServerName a.somedomain1.com
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/a"
</VirtualHost>
etc...
So, I guess this means there is something going on with php when the other vhosts try to display their respective site.
Let's try and nail this down. I'm using PHP with the above format for VHosts, and it's working just fine. So let's make sure we've got the VHosts working first, then we'll try and debug php.
Can you put an index.html file in each of the virtualhosts directory and try to access it? Make sure you have a different index.html per site, so you know that it's working!