Project

General

Profile

W3CMarkupValidator » History » Revision 2

Revision 1 (zours, 2007-08-26 03:20) → Revision 2/11 (zours, 2007-08-26 03:24)

= 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 only tested on Ubuntu Feisty (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 almost all 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-enabled/}}}. Name it, for example, {{{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 alias 
 invoke-rc.d lighttpd restart 
 }}} 

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