The Linux Page

Installing the W3C XHTML validator on your Ubuntu server

History

Today I finally noticed that the W3C validator was open source (some people are real slow!)

This means I can get the source and run that validator on my system! Cool!

Under Debian you can just download the package with:

   apt-get install w3c-markup-validator

The will properly install the module, however, it won't be recognized just as is. I had to do several things to get things to mostly work...

Domain

If you want to use a specific domain name, you will need to edit your bind configuration file and add it.

Apache

Now, Apache is seemingly setup properly to support that system automatically. That is, the default server is, not the one I have tweak for the last few years and has nothing to do with the default Apache.

So... On my end I added the following:

# W3C XML/HTML validator
<VirtualHost *:80>
    ServerAdmin webmaster@m2osw.com
    DocumentRoot /usr/share/w3c-markup-validator/html/
    ServerName validator.m2osw.com
    ScriptAlias /check /usr/lib/cgi-bin/check
    ErrorLog /var/log/apache2/validator.m2osw.com-error_log
    CustomLog /var/log/apache2/validator.m2osw.com-access_log combined
</VirtualHost>

which you should use as an example only since your server may have global settings that are compatible or incompatible with that entry!

First I define the path to the document root (/usr/share/w3c-markup-validator/html/) That's where you have the index.html file.

Then, I tell my server that the /check script is under /usr/lib/cgi-bin/check (I'm not too sure what's up with that... it looks wrong to me!)

I can enter a URL with the protocol (i.e. http://www.example.com) and it will result in a page with all the errors (if any.) And if you are using Drupal, it should work just fine use your own theme... or a slopy theme or you type some bad things in your pages...

But it still doesn't work?!

Exactly. Maybe that's my system, again, but somehow the validator.conf that's supposed to be used to find the templates directory had no effect (seemingly). So I edited the check script and hand coded the correct path straight in there. Then it worked just fine. Not too sure what's up with that one either!

  #my $base_path = $ENV{W3C_VALIDATOR_HOME} || '/usr/local/validator';
  my $base_path = '/usr/share/w3c-markup-validator';

That was it. Now it works!