Project

General

Profile

W3CMarkupValidator » History » Revision 9

Revision 8 (dotfolios, 2009-10-17 11:59) → Revision 9/11 (dotfolios, 2009-10-17 12:00)

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@} (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> 


 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  

 <pre> Allow Private IPs = yes </pre> 

 Then always in root : 

  

 <pre> 
 # 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 
 </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.