[Nottingham]Web server questions

Robert Postill robert at grinning-cat.com
Sat Apr 9 17:08:08 BST 2005


On Sat, 2005-04-09 at 16:11 +0100, Joshua Lock wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Good afternoon the list,
Hi Josh :)
> I wonder if anyone might be able to help me out or at least point me in 
> the right direction.
> I have some web hosting on a virtual Apache server with Hosting 
> Unlimited.
They let you at the httpd.conf right?
> Firstly I want to host two sites on one virtual server.
> What I'd ideally like to do is have the sites only accessible by the 
> domain names assigned to them. I wonder if this is even possible? If so 
> how would I go about doing this considering I don't have access to the 
> httpd.conf for the server.
This is called virtual hosting and can be done by any combination of
name, IP address and port.  What you do is set a DocumentRoot for each
site (I'd try and keep them seperate as much as possible by *not* having
an accessible parent) and then defaulting to one or other in you main
section.  Using this appraoch your single apache instance will scale to
a significant number of domains (so long as you're not hosting
slashdot :).  The rough form is:
User webuser
Group webgroup

NameVirtualHost 192.168.123.2

<VirtualHost www.butterthlies.com>
#ServerName www.butterthlies.com
ServerAdmin sales at butterthlies.com
DocumentRoot /usr/www/APACHE3/site.virtual/htdocs/customers
ErrorLog /usr/www/APACHE3/site.virtual/Name-based/logs/error_log
TransferLog /usr/www/APACHE3/site.virtual/Name-based/logs/access_log
</VirtualHost>

<VirtualHost sales.butterthlies.com>
#ServerName sales.butterthlies.com
ServerAdmin sales at butterthlies.com
DocumentRoot /usr/www/APACHE3/site.virtual/htdocs/salesmen
ServerName sales.butterthlies.com
ErrorLog /usr/www/APACHE3/site.virtual/Name-based/logs/error_log
TransferLog /usr/www/APACHE3/site.virtual/Name-based/logs/access_log
</VirtualHost>
Which comes from O'Reillys Apache: the Definitive Guide by Ben and Peter
Laurie (page 87 if you have a copy).Also check
http://www.apache.org/docs/vhosts for the reference documentation.
> Also does anyone know how to stop search engines from indexing certain 
> folders?
robots.txt is a file you stick on the root of each site e.g.
http://www.mydomain.com/robots.txt which tells the search engines where
they should and should not go.  Try
http://www.searchengineworld.com/robots/robots_tutorial.htm for some
more info.  Be aware though that certain robots (spam harvesters are a
good example) won't bother, so if it's sensitive wrap it in Directory
and Require combo to put off most simple intrusions.
Robert.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mailman.lug.org.uk/pipermail/nottingham/attachments/20050409/b2e62dcf/attachment.bin


More information about the Nottingham mailing list