LocalW3CMirror

From W3C Tools Support Wiki

www.w3.org on your laptop

For testing purposes, it is often useful to use one's local machine and CVS checkout as a local, simplified mirror of www.w3.org, where you can test pages and scripts before commiting them to CVS.

This can be achieved by having a local instance of the apache server using the CVS local copy as Root Directory.

CVS

This guide assumes you have a working copy of W3C's CVS. If not, refer to SettingUpSshCvs first.

DNS (optional, but recommended)

Because a number of links will be absolute (e.g /WAI/ instead of ../../WAI) it is important that the root of the local site and that of W3C's coincide. So for instance, serving a CVS checkout from http://localhost/w3c/ will not work.

For that purpose, one can tweak the local hosts resolution config to use e.g w3c.localhost as an alias to localhost or 127.0.0.1:

  • Linux: edit /etc/hosts
  • Mac: start the NetInfo Manager, go to "machines", duplicate the entry for localhost, rename it as you wish (I named it w3c.localhost)
  • Windows: @@ @@

Apache

Setting apache to be a simplified mirror of w3c basically involves setting a proper DocumentRoot. There are a few other tricks.

If you have used the DNS trick described above, you will want to use Apache's VirtualHost feature, as follows:

 	<VirtualHost 127.0.0.1>
         DocumentRoot /your/path/to/cvscheckout/WWW
         ServerName w3c.localhost
	</VirtualHost>

A basic apache config will not have ACLs installed, so you want to protect this new server from curious eyes. Use at least some IP filtering:

    <Directory /your/path/to/cvscheckout/WWW>
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>

(and set up a password too with htpasswd if you feel like it)

Restart apache. You can now access a "fake" W3C site at http://w3c.localhost