Message Board -  Archive

[ Login ] [ Create Account ]
[ Board List ] [ View Board ] [ Post Reply ]
  Author  Subject: Re: Apache Config
Archive  

Posted on 12-20-2001 10:47 p.m. ET  reply

Original Poster: "Mark W. Krentel" <krentel@dreamscape.com>

> Now, I have a few people asking to put their sites on my server. I do not
> want to use my domain names (in the form domain/~user as is allowed by
> default) to point to other peoples sites on my server. Since once of my sites
> is used for business, it does not seem like a good idea.

Yes, I understand what you're trying to do (I think) and Apache can
do that. But you're not giving me the technical details of what you
tried and how it failed. I can't tell if your problem is routing,
name service, firewall or apache config. And assuming it's apache
config, it could be user directory, virtual host or access control.
I'll probably need to look at your httpd.conf file to decide.

But let's assume the problem is in apache config. I haven't used
virtual hosts before, but your question intrigued me, so I read the
docs and did a little experiment. I have a machine, www.mwk.domain,
on my private network that I run as a clone of the Syrlug web site for
tests. I added the name users.mwk.domain as an alias for the same
machine to serve user directories.

I wrote a minimal VirtualHost section in httpd.conf for the two names
as follows. www.mwk.domain serves the Syrlug pages from /home/httpd/html
but no user directories, whereas users.mwk.domain serves only user
directories. (The machine has a small disk, so /home is symlinked to
/usr/home, and I'm not using FollowSymLinks outside of DocumentRoot.)

NameVirtualHost *

<Directory />
Options None
AllowOverride None
Deny from all
</Directory>

<VirtualHost *>
ServerName www.mwk.domain
DocumentRoot /usr/home/httpd/html
UserDir disabled
<Directory /usr/home/httpd/html>
Options All
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *>
ServerName users.mwk.domain
DocumentRoot /usr/home/httpd/empty
UserDir /usr/home/*/public_html
<Directory /usr/home/*/public_html>
Options All
Allow from all
</Directory>
</VirtualHost>

I verified that http://www.mwk.domain/ returns the Syrlug home page as
usual, but http://users.mwk.domain/ gives a "Forbidden" message in
Netscape and a "client denied by server configuration" message in
error_log. Also, http://users.mwk.domain/~mwk/ returns my simple
index file, but http://www.mwk.domain/~mwk/ gives "Not Found" in
Netscape and a "File does not exist" message in error_log.

If I understand your intent correctly, you'll probably need something
similar to the above in your httpd.conf file. Of course, you'll also
want more sophisticated access control and aliases in your <Directory>
sections. And note that I moved my "main" ServerName inside <VirtualHost>.

If you want to mail me your httpd.conf file, I'll take a look.

> So, I would like to modify the Vhosts files to allow a users domain (say
> usersdomain.com for example)

What is the Vhosts file?? I understand <VirtualHost>, but I've never
heard of Vhosts. Is it an Apache config file? Are you at least
running this on Unix?

Hope that helps,

--Mark

< Previous 1 Next >

Site Contents