Project

General

Profile

W3CMarkupValidator » History » Revision 7

Revision 6 (zours, 2007-11-25 06:21) → Revision 7/11 (zours, 2007-11-25 06:21)

h1. = 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.''' 


 h2. 

 == 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). 


 h2. 

 == Let's do it! 


 == 

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

 <pre> 

 
 {{{ 
 lighty-enable-mod alias 
 lighty-enable-mod cgi 
 invoke-rc.d lighttpd restart 
 </pre> 


 }}} 

 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@} {{{20-w3c-markup-validator.conf}}} (you'll need it to start after the other modules anyway). 

 Paste these lines in the file : 

 <pre> 

 
 {{{ 
 ## 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" => "") 
 } 
 </pre> 


 }}} 

 Finally, enable this new module : 

 <pre> 

 
 {{{ 
 lighty-enable-mod w3c-markup-validator 
 invoke-rc.d lighttpd restart 
 </pre> 


 }}} 

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