[Gloucs] apache virtual hosts

Guy Edwards guy_j_edwards at hotpop.com
Sat Sep 18 21:00:52 BST 2004


On Sat, 2004-09-18 at 17:30, Richard Mellersh wrote:
> Thanks for the reply, it's not yet sorted, in fact it's worse.

I'm not entirely sure what you're up to but the following might help a
bit, I've got Debian here so I don't have a vhosts.conf...

> I suppose it is "mucking around" but I REALLY want it to work from outside but 
> without DNS yet (I don't know how or how much it is to do DNS).  What I 
> thought would work is if I give friends/ colleagues etc an address such as 
> http://195.112.17.79/site1 or http://195.112.17.79/site2 I could somehow use 
> apache to redirect these requests to various directories.

[disclaimer: Guy is not an Apache admin (yet)]

Out of the following I think the first idea is the one you're after,
treat the rest as just helpful info.

Note: you still need to modify the DNS with this so that peoples
machines actually know that fredbloggs.myserversomewhere.co.uk
translates to a certain IP, otherwise they won't be able to find you. 

You can redirect queries using Apache and redirect to another
destination/server/folder... easier if I show you ... yours might look
something like:

[...]
NameVirtualHost your.ip.address.here
 <VirtualHost your.ip.address.here>
 Servername myserversomewhere.co.uk
 </VirtualHost>
 
 <VirtualHost your.ip.address.here>
 Servername fredbloggs.myserversomewhere.co.uk
 ServerAlias *
 Redirect permanent / http://mybigserversomewhere.co.uk/fredbloggssite/
 </VirtualHost>
[...]

so requests to fredbloggs.myserversomewhere.co.uk would redirect to 
http://myserversomewhere.co.uk/fredbloggssite/


Other not as good ideas that might help you one day:

You can have different sites running of different ports (80,81,82,83
etc) if a client connects to port 80, send them to one folder, if they
connect to 81 another....
url would appear like http://server.somewhere.some.dom:82/
have a look at some of the other cool ways (quick google) you can
redirect here:
http://quark.humbug.org.au/publications/apache/apache-redirect.html
like sending people to different machines based on what folder they
access etc.

No DNS changing access? Well you could use symlinks which I've guess
you've tried but I think isn't exactly what you're asking for. If you
really trust people not to be bad you can turn on symlinks per directory
in Apache if you wish with (showing a big section so you get an idea of
usage):
[...]
<VirtualHost localhost>
        ServerName localhost
        ServerAdmin webmaster at localhost
        DocumentRoot /var/www/friends
        <Directory /var/www/friends>
                Options FollowSymLinks
                AllowOverride None
        </Directory>

Although it's safer to do the following:
	Options SymLinksIfOwnerMatch 

and then of course just make a link in the normal way
mymachine:/var/www/friends# ln -s /home/bob/www bobsdir

If you can persuade work to buy you a book, check out "Apache the
Definitive Guide", O'Reilly, Chapter3 or so relates to all this. 

There's a fair number webhosting people on the list who will hopefully
point out if I've completely got the wrong solutions here or made some
error.

Guy





More information about the gloucs mailing list