On Thu, 2010-02-04 at 11:31 +1300, Roger Searle wrote: > steve wrote: > > sudo apt-get install apache2 ( approximately ), and adjust the document > > root to point to the local folder containing the wiki. Then the wiki > > will be available at http://jupiter > > > > Which is what I do (: > > > Thanks for all of yesterday's replies, seeing the apache "it works" page > was simple, now I'm trying to set up a second site generally following > this guide > > https://help.ubuntu.com/8.04/serverguide/C/httpd.html > > though have missed something or doing something wrong. I have done the > following: > > *sudo cp /etc/apache2/sites-available/default > /etc/apache2/sites-available/policymanual > > and then in /etc/apache2/sites-enabled/policymanual edited DocumentRoot > and Directory to point to the correct location. > > **Then run "sudo a2ensite policymanual", and "sudo apache2ctl -t" > returns Syntax OK. > > Browsing to http://jupiter/policymanual/index.html returns > > * > > > Forbidden > > You don't have permission to access /policymanual/index.html on this server. > > Have checked that everyone has +x permissions on the DocumentRoot > folder, and the index.html file exists. > > I'm not sure what I have missed that is important and where to go from > here, any pointers or hints would be gratefully received. > > Cheers, > Roger > > > You're using name based virtual hosting... bet you didn't know that!
To do this ( bear with me as every distro does this in different files
this is a hardy install. )
1. You need a NameVirtualhost at the top of the 'default' config.
NameVirtualHost *
This means that all following VH configs must start with (ok this isn't
true, but bear with me!)...
<VirtualHost *>
and not <VirtualHost *:80> for example.
2. You need to identify the next host by name, so in it's setup file,
you need a
ServerName mywiki.example.com
or similar to identify it. Personally, I also set up specific log files
for each site so you can tract traffic, error more easily.
ErrorLog /var/log/apache2/mywiki.example.com-error.log
CustomLog /var/log/apache2/mywiki.example.com-access.log combined
Here's an example of a really simple one of mine ( and anyone who wants
to redesign the site... please do! )
--8<--
<VirtualHost *:80>
ServerName dh.greengecko.co.nz
ServerAdmin [email protected]
DocumentRoot /www/dh.greengecko.co.nz
ErrorLog /var/log/apache2/dh.greengecko.co.nz-error.log
CustomLog /var/log/apache2/dh.greengecko.co.nz-access.log combined
<Directory /www/dh.greengecko.co.nz>
Options All
AllowOverride All
Order deny,allow
allow from all
</Directory>
</VirtualHost>
--8<--
3. The above name must resolve. On the web server itself, I
modify /etc/hosts to resolve all of these websites to the IP address of
the server itself ( some use 127.0.0.1, but I don't ).
This means that the webserver itself will come up without any errors,
and be serving the multiple domains.
4. Permissions.
simplest to ensure there's no problems - not something I'd recommend in
a production environment...
cd <DocumentRoot> ( eg /www/dh.greengecko.co.nz )
sudo chown -R www-data:www-data .
Which will ensure that your web server has permissions to access the
content.
Next, you need to ensure that your site name resolves to the client, so
you need to run either a local DNS server, or to modify /etc/hosts on
each client. I know what I'd do ( and probably use OpenDNS as resolvers
to filter some of the traffic, no matter what abuse they make of the
standards ).
Not difficult once you get your head around it, just more steps than
you'd expect.
hth,
Steve
--
Steve Holdoway <[email protected]>
http://www.greengecko.co.nz
MSN: [email protected]
GPG Fingerprint = B337 828D 03E1 4F11 CB90 853C C8AB AF04 EF68 52E0
signature.asc
Description: This is a digitally signed message part
