Project

General

Profile

Actions

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" => "")
}

For debian users ( I don't know for other distros ), who use only lighttpd, there others things todo :

Edit in root : /etc/w3c/validator.conf

 Allow Private IPs = yes 

Then always in root :

# cd /etc/apache2/conf.d
# cp  w3c-markup-validator.conf  w3c-markup-validator.conf.bak
# rm -rf  w3c-markup-validator.conf
# ln -s /etc/w3c/apache.conf w3c-markup-validator.conf

In Debian unstable replace the above ligne :

# ln -s /etc/w3c/apache.conf w3c-markup-validator.conf

by
# ln -s /etc/w3c/w3c-markup-validator-apache.conf w3c-markup-validator.conf

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 dotfolios over 12 years ago · 11 revisions