Project

General

Profile

Actions

W3CMarkupValidator » History » Revision 7

« Previous | Revision 7/11 (diff) | Next »
zours, 2007-11-25 06:21


Using W3C Markup Validator with Lighttpd

This is a quick guide to help you configure the w3c-markup-validator for use with Lighttpd.

'''This example was tested on Ubuntu Feisty and Ubuntu Gutsy (but it should work with any Debian-based system), and with w3c-markup-validator v0.7.4.'''

Lighttpd doesn't speak Apache fluently

Some times ago I switched many of my web servers from Apache to Lighttpd (some still have Apache, because of subversion).
When I did so, I was happy to see that almost everything worked perfectly -- almost.

The one thing that obviously didn't work, was the w3c-markup-validator. Using the one available online isn't always an option, if you're developing in an intranet, with no direct external access from the outside.

w3c-markup-validator is configured via some Apache-only directives. I struggled quite a bit, trying to figure out how to reproduce the configuration for Lighttpd (I wasn't even sure it was possible).

Let's do it!

First of all, you'll need to enable a few modules :


lighty-enable-mod alias
lighty-enable-mod cgi
invoke-rc.d lighttpd restart

Then, create a new configuration file in {{{/etc/lighttpd/conf-available/}}}. Name it, for example, {{{20-w3c-markup-validator.conf}}20-w3c-markup-validator.conf} (you'll need it to start after the other modules anyway).

Paste these lines in the file :


## W3C markup validator service

$HTTP["remoteip"] == "127.0.0.1" {
        alias.url += (
                "/validator/checklink" => "/usr/lib/cgi-bin/checklink",
                "/validator/check" => "/usr/lib/cgi-bin/check",
                "/validator/" => "/usr/share/w3c-markup-validator/html/" 
        )

        cgi.assign += ("/check" => "")
}

Finally, enable this new module :


lighty-enable-mod w3c-markup-validator
invoke-rc.d lighttpd restart

Now, try accessing {{{http://localhost/validator/}}} and you're done.

Updated by zours almost 17 years ago · 7 revisions