このサイトが動いてる共用サーバのソフトのバージョンアップをしばらくサボっていたので、一気にバージョンを上げてみた。バージョンをあげたのは、
php-5.2.3
APC-3.0.14
gd-2.0.34
pcre-7.1
freetype-2.3.4
libpng-1.2.18
mysql-5.0.41
lighttpd1.4.15
くらいかな。
基本的には新しいソースを拾ってきて、
解凍→configure ~→make→make install
というお約束の流れ出でだいたい終わるんだけど、lighttpd1.4.15だけだめっぽい。
$ make
make[2]: Entering directory `/usr/home/hoge/src/lighttpd/lighttpd-1.4.15/src'
/usr/local/bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -DLIBRARY_DIR="\"/home/hoge/root/lib\"" -I. -I.. -D_REENTRANT -D__EXTENSIONS__ -I/home/hoge/root/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O2 -Wall -W -Wshadow -pedantic -std=gnu99 -MT mod_extforward.lo -MD -MP -MF .deps/mod_extforward.Tpo -c -o mod_extforward.lo mod_extforward.c
gcc -DHAVE_CONFIG_H -DLIBRARY_DIR=\"/home/hoge/root/lib\" -I. -I.. -D_REENTRANT -D__EXTENSIONS__ -I/home/hoge/root/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O2 -Wall -W -Wshadow -pedantic -std=gnu99 -MT mod_extforward.lo -MD -MP -MF .deps/mod_extforward.Tpo -c mod_extforward.c -fPIC -DPIC -o .libs/mod_extforward.o
In file included from mod_extforward.c:5:
/usr/include/netinet/in.h:235: error: syntax error before "in_addr_t"
/usr/include/netinet/in.h:287: error: syntax error before "u_char"
/usr/include/netinet/in.h:288: error: ISO C forbids data definition with no type or storage class
/usr/include/netinet/in.h:289: error: syntax error before "sin_port"
/usr/include/netinet/in.h:289: error: ISO C forbids data definition with no type or storage class
/usr/include/netinet/in.h:292: error: syntax error before '}' token
/usr/include/netinet/in.h:349: error: field `imr_multiaddr' has incomplete type
/usr/include/netinet/in.h:350: error: field `imr_interface' has incomplete type
In file included from /usr/include/netinet/in.h:487,
from mod_extforward.c:5:
/usr/include/netinet6/in6.h:122: error: syntax error before "u_int8_t"
/usr/include/netinet6/in6.h:123: error: ISO C forbids data definition with no type or storage class
/usr/include/netinet6/in6.h:124: error: syntax error before "__u6_addr32"
/usr/include/netinet6/in6.h:124: error: ISO C forbids data definition with no type or storage class
/usr/include/netinet6/in6.h:125: error: syntax error before '}' token
/usr/include/netinet6/in6.h:125: error: ISO C forbids data definition with no type or storage class
/usr/include/netinet6/in6.h:126: error: syntax error before '}' token
/usr/include/netinet6/in6.h:144: error: syntax error before "u_int8_t"
/usr/include/netinet6/in6.h:145: error: ISO C forbids data definition with no type or storage class
/usr/include/netinet6/in6.h:146: error: syntax error before "sin6_port"
/usr/include/netinet6/in6.h:146: error: ISO C forbids data definition with no type or storage class
/usr/include/netinet6/in6.h:147: error: syntax error before "sin6_flowinfo"
/usr/include/netinet6/in6.h:147: error: ISO C forbids data definition with no type or storage class
/usr/include/netinet6/in6.h:149: error: syntax error before "sin6_scope_id"
/usr/include/netinet6/in6.h:149: error: ISO C forbids data definition with no type or storage class
/usr/include/netinet6/in6.h:382: error: field `ro_dst' has incomplete type
/usr/include/netinet6/in6.h:451: error: field `ipv6mr_multiaddr' has incomplete type
/usr/include/netinet6/in6.h:459: error: field `ipi6_addr' has incomplete type
/usr/include/netinet6/in6.h:612: error: syntax error before '*' token
/usr/include/netinet6/in6.h:614: error: syntax error before '*' token
/usr/include/netinet6/in6.h:614: error: ISO C forbids data definition with no type or storage class
/usr/include/netinet6/in6.h:615: error: syntax error before "u_int8_t"
/usr/include/netinet6/in6.h:616: error: syntax error before "u_int8_t"
/usr/include/netinet6/in6.h:631: error: syntax error before "u_int8_t"
/usr/include/netinet6/in6.h:636: error: syntax error before "u_int8_t"
/usr/include/netinet6/in6.h:638: error: syntax error before "u_int8_t"
base.h:127: error: field `ipv4' has incomplete type
mod_extforward.c: In function `mod_extforward_uri_handler':
mod_extforward.c:373: error: type of formal parameter 1 is incomplete
mod_extforward.c:402: warning: unused variable `addrs_left'
mod_extforward.c: At top level:
/usr/include/netinet/in.h:290: error: storage size of `sin_addr' isn't known
/usr/include/netinet6/in6.h:148: error: storage size of `sin6_addr' isn't known
make[2]: *** [mod_extforward.lo] Error 1
make[2]: Leaving directory `/usr/home/hoge/src/lighttpd/lighttpd-1.4.15/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
「sin_addrなぞ知らん」と言われるので、./src/mod_extforward.cファイルに「#include <sys/types.h>」を入れてみる。
入れる部分はこのあたり。
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h> ←ここ
#include <netinet/in.h>
#include "base.h"
これで無事にコンパイルが通った。
ちなみにこのエラーになったのはmod_extforwardモジュールのコンパイル部分。なんじゃこのモジュールは?って調べたらこのモジュールが搭載されたのは最近の話らしい。
で、このモジュールはproxy環境下で動いてる場合、ログに出力するRemoteIPはproxyのIPになるんだけど、それを本来の接続ホストのIPに変えてくれる(IPアドレスはproxyの吐くヘッダ情報から抜き出すとか)。
proxy環境なんてまさにうちの環境!表にapache、裏でlighttpdが動いているので、早速このモジュールを有効にして使ってみる……が、うごかねぇ。色々やったけど、ログに出力されるRemoteIPはProxyのIPから変わらず。やっぱコンパイルのときの修正がダメなのかなぁ。
と、ここでふと思う。RemoteIPの変更は諦めて、Proxyが吐くヘッダに書かれている本来の接続元IPをそのままログに残せばいいのでわと。
というわけで、今のうちのサイトのログ設定。
accesslog.format = "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{X-FORWARDED-FOR}i\""
最後のX-FORWARDED-FORに本来の接続元IPが入ります。
作成日:2007/06/07 03:17:38