Nat,

On May 31, 2007, at 11:34 AM, Nat Colley wrote:

That should really do the trick. However, you mentioned before that your client arrives at the wrong virtual host, so we'll need to find out what exactly happens and why.

# Use name-based virtual hosting.
#
NameVirtualHost *:80
#VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
<VirtualHost *:80>
    ServerAdmin [EMAIL PROTECTED]
    DocumentRoot /www/webapps/wordpress
    ServerName mydomain1.com
    ServerAlias www.mydomain1.com
    ErrorLog logs/mydomain1.com-error_log
    CustomLog logs/mydomain1.com-access_log common
</VirtualHost>

As it says above, the first virtual host in the list is a special beast because it receives HTTP requests that don't match any virtual hosts in the list. Matching is done through the Host: header that the browser sends, which is in turn filled in by the browser with the hostname you typed into its Location bar.

Apache will serve any request that arrives, and anything that is not matched to a particular virtual host will be served by the first one in the list.

To make a match, you'll need to make sure that you type the correct hostname into the browser, and that your system is set up to resolve that hostname to the correct IP address. You can do this through DNS or through a local HOSTS file on your system, but that kind of falls outside the scope of this list.

<VirtualHost *:80>
    ServerAdmin [EMAIL PROTECTED]
    DocumentRoot /www/webapps/joomla
    ServerName mydomain2.com
    ServerAlias www.mydomain2.com
    ErrorLog logs/mydomain2.com-error_log
    CustomLog logs/mydomain2.com-access_log common
</VirtualHost>

> > notice that in this configuration he has changed
> the files the web is served
> > content from htdocs to something else, and further
> aliased that to yet
> > another directory where the applications are. So
> mydomain1 and mydomain2
> > both go to the same page, and mydomain1/app2 comes
> up even though app2 is
> > supposed to be the content for mydomain2. I asked

I'm not really seeing that in the configuration above. It looks like your DocumentRoot is /www/webapps/wordpress and /www/webapps/joomla respectively, which are perfectly separate. These may be symbolic links to somewhere else on the file system level, but we can't see that from here and if you have Options FollowSymLinks there's no problem with that.

The only problem with a forest of symbolic links is that it becomes hard to see the trees... better to keep things simple, and in the case of the above you might change DocumentRoot to the actual location of the content, and put in an appropriate <Directory> block to control access.

S.

--
Sander Temme
[EMAIL PROTECTED]
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF



Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to