Another HTML-lint
http://openlab.ring.gr.jp/k16/htmllint/htmllinte.html
Another HTML-lintはHTML文法チェッカーの老舗であり、Perlソースが公開されている。VMWare上のCentOS/5.5(32bit版)への設置手順を説明する。
[動作環境]
・Windows7上のVMWareにCentOSをインストールした。
・CentOSのIPアドレスを 192.168.0.4 とする。
・WindowsのWebブラウザで、http://192.168.0.4/ にアクセスすると「Apache 2 Test page powered by CentOS」と表示されること。
(1) Windows上の作業
●htmllint.zipをダウンロードする。(記事投稿時2011-11-28 16:17版)
●zipファイルを解凍すると、htmllint/ の下にディレクトリ階層なしで全ファイルが展開される。
●htmllintenv を htmllint.env へコピーまたはリネームする。
●htmllint.cgi、taglist.cgi の先頭行(perlパス)を編集する。
編集前
#!/usr/local/bin/perl
編集後
#!/usr/bin/perl
(2) WindowsのWinSCPで、CentOSへアップロード
●/var/www/cgi-bin/htmllint/htmllint.cgi の位置へ全ファイルをアップロードする。
●htmllin.cgi、taglist.cgi のアクセス権限を755 に設定する。
○WindowのWebブラウザで、http://192.168.0.4/cgi-bin/htmllint/htmllint.cgi を開き、「Another HTML-lint error!」と表示されるか?
サーバエラー → (1) と (2) へ
○WindowsのWebブラウザで、http://192.168.0.4/cgi-bin/htmllint/htmllint.html を表示できるか?
できない →(3)へ
○htmllint.htmlのURL欄に「http://www.yahoo.co.jp」を入力し[check]する。結果が表示されたか?
「調整中です」 →(4)へ
(3) CentOSでsshログイン作業
CentOSインストール直後は、/cgi-bin/ 下は *.cgi、*.pl以外は表示できない。htmlやcssを表示できるように/etc/httpd/conf/httpd.confを編集する。
編集前
<Directory "/var/www/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory>
編集後
<Directory "/var/www/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all AddHandler text/css css AddHandler text/html html AddHandler image/gif gif </Directory>
●webサーバを再起動する。
[root@192.168.0.4]# service httpd restart
○WindowのWebブラウザで、http://192.168.0.4/cgi-bin/htmllint/htmllint.html を表示できるはず。
(4) CentOSでsshログイン作業
gccとPerlモジュールをインストールする。いろいろ聞かれたら yes または y を入力して進める。
[root@192.168.0.4]# yum -y install gcc
[root@192.168.0.4]# cpan
cpan> install Jcode
cpan> install CGI
cpan> install LWP
cpan> exit
○WindowsのWebブラウザで、http://192.168.0.4/cgi-bin/htmllint/htmllint.html を表示し、URL欄に「http://www.yahoo.co.jp」を入力し[check]する。結果を表示できるはず。