[Gllug] VirtualHost on Apache 1.3.31 problem

Ian Norton bredroll at darkspace.org.uk
Sat Mar 19 19:56:01 UTC 2005


On Fri, Mar 18, 2005 at 02:42:02PM +0000, Richard Turner wrote:
> On Fri, 2005-03-18 at 14:32 +0000, N.Pauli wrote:
> > Dear All,
> > 
> > This one has got me completely going around in circles. I'm trying to
> > set up VirtualHosts on the Apache 1.3.31 server on my workstation.
> > Browsing to http://localhost brings up the page I've left there but
> > http://localhost/sjweb/ gives me 404 Not Found. I've had this working
> > before on Apache 1.3.x using this configuration.
> > 
> > NameVirtualHost localhost
> > <VirtualHost localhost>
> > 	ServerAlias	localhost
> > 	DocumentRoot	/var/www
> > </VirtualHost>
> > <VirtualHost localhost>
> > 	ServerAlias	sjweb
> > 	ServerName	sjweb
> > 	DocumentRoot	/home/nbp/Web/SJweb
> > 	ErrorLog	/home/nbp/Web/SJweb/logs/error_log
> > </VirtualHost>
> 
> Um, if http://localhost -> /var/www then http://localhost/sjweb -
> > /var/www/sjweb, hence 404.

The two <VirtualHost> stanzahs you have setup two virtual domains running on
the localhost (127.0.0.1) address.

now, if you only need to access these virutal domains from this computer then
all you need to do is add 'sjweb' to the end of the localhost line in 
the /etc/hosts file .

giving something like this..

 127.0.0.1      localhost localhost.localdomain sjweb


after you have done this, if you run a browser on the server and visit
http://localhost   you should get the first site, http://sjweb should give you
the second site.

If you want these domains to be availible from places other than this one
computer then you need to make some changes.

1. change '<VirtualHost localhost>' to '<VirtualHost *>'
2. change 'ServerAlias localhost'  to 'ServerAlias website1'
   change 'ServerAlias sjweb' to 'ServerAlias website2'
   change 'ServerName sjweb' to 'ServerName website2'

where website1 and website2 are hostnames that you want to use (ie,
sjweb.homedns.org, sjweb.myhouse or www.google.foo etc..)

That lot will make apache listen on all the network interfaces of the server.

if you want to restrict access to one interface simply put the IP address of
that interface in the <VirtualHost x.x.x.x> parts.

Good luck, post back if you have difficulty with the domain name part, there
are a number of fairly easy free methods of getting a domain name that you
could use.


> Configure DNS so that 'sjweb' is an alias to your workstation and this
> config will work when you try http://sjweb/ (at least, I think it will,
> I'm no expert!)
> 
> Presumably you could set a symlink from /var/www/sjweb -
> > /home/npb/Web/SJWeb too, never tried. You'll have to make sure all the
> filesystem permissions are set correctly, but you'll know when that's
> the problem because you'll start seeing 'Permission Denied' instead of
> 'Not Found'.
> 
> Cheers,
> 
> Richard.
> 
> -- 
> "Racing turtles, the grapefruit is winning..."
> 
> B53 8184 E61F 3604 FBF3  4CCB EF07 2942 30F2 739E



> -- 
> Gllug mailing list  -  Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug


-- 
Ian Norton-Badrul

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list