玄箱HGにFedoraを入れて自宅サーバを構築 - Amonution

WebDAVサーバー構築

概要

内部からsambaでアクセスしているディレクトリを、外部からアクセスするため、WebDAVサーバを構築します。
ApacheがVer.2.0系であれば、既にインストール済みです。
WebDAVは実行ユーザーであるapache権限でアクセスを行います。そのため、Sambaで作成したファイルにはアクセス出来ません。
そこで、ACLアクセス制御機能を利用して、WebDAVでアクセスするディレクトリはapache権限でアクセスが可能なように設定します。

ACLアクセス制御のインストール

yumを使用してインストールします。

[root@KURO-F7 ~]# yum -y install acl libacl
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
Setting up Install Process
Parsing package install arguments
Package libacl - 2.2.39-12.fc8.ppc is already installed.
Resolving Dependencies
--> Running transaction check
---> Package acl.ppc 0:2.2.39-12.fc8 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 acl                     ppc        2.2.39-12.fc8    updates            76 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 76 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: acl                          ######################### [1/1]

Installed: acl.ppc 0:2.2.39-12.fc8
Complete!

ACLアクセス制御の有効化

ACLアクセス制御機能を利用して、WebDAVでアクセスするディレクトリのみ、apache権限でのアクセスを可能にします。

[root@KURO-F7 ~]# vi /etc/fstab

ルート'/'ディレクトリのACLを追加
/dev/hda3       /               ext3    defaults,noatime,errors=remount-ro,acl      0 1

ACLアクセス有効を即時反映させる
[root@KURO-F7 ~]# mount -o remount /

共有ディレクトリの属性を変更
[root@KURO-F7 ~]# chmod 711 /home/public/

WebDAV用のディレクトリを作成
[root@KURO-F7 ~]# mkdir /home/public/webdav

オーナーを変更
[root@KURO-F7 ~]# chown SambaUser. /home/public/webdav/

共有ディレクトリへapacheグループ権限で参照・更新・実行を許可する
[root@KURO-F7 ~]# setfacl -m g:apache:rwx,g:apache:rwx /home/public/webdav/

共有ディレクトリへ新規作成するファイルへapacheグループ権限で参照・更新・実行を許可する
[root@KURO-F7 ~]# setfacl -m d:g:apache:rwx,g:apache:rwx /home/public/webdav/

共有ディレクトリへSambaUserグループ権限で参照・更新・実行を許可
[root@KURO-F7 ~]# setfacl -m g:SambaUser:rwx,g:mirano:rwx /home/public/webdav/

共有ディレクトリへ新規作成するファイルへfedoraグループ権限で参照・更新・実行を許可
[root@KURO-F7 ~]# setfacl -m d:g:SambaUser:wrx,g:mirano:wrx /home/public/webdav/

共有ディレクトリのACL設定確認
[root@KURO-F7 ~]# getfacl /home/public/webdav/
getfacl: Removing leading '/' from absolute path names
# file: home/public/webdav/
# owner: nobody
# group: nobody
user::rwx
group::r-x
group:apache:rwx	apacheグループによる参照・更新・実行が許可されている
group:SambaUser:rwx	miranoグループによる参照・更新・実行が許可されている
mask::rwx
other::r-x
default:user::rwx
default:group::r-x
default:group:apache:rwx	新規作成するファイルにapacheグループによる参照・更新・実行が許可されている
default:group:SambaUser:rwx	新規作成するファイルにmiranoグループによる参照・更新・実行が許可されている
default:mask::rwx
default:other::r-x

これにより、今までsambaで書き込みができなかったpublicへの書き込みが、SambaUserユーザーで可能になります。

mod_encodingのインストール

WindowsでWebDAVにアクセスすると、日本語のファイル名が化ける可能性があります。これを解決するために、mod_encodingをインストールします。
次のサイトを参考にしてください。
※WebDAV環境における日本語ファイル名の問題
まずは、mod_encodingのインストールに必要なapxsを含んだhttpd-develをインストールします。

[root@KURO-F7 ~]# yum -y install httpd-devel

Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package httpd-devel.ppc 0:2.2.6-3 set to be updated
--> Processing Dependency: pkgconfig for package: httpd-devel
--> Processing Dependency: apr-util-devel for package: httpd-devel
--> Processing Dependency: apr-devel for package: httpd-devel
--> Running transaction check
---> Package pkgconfig.ppc 1:0.22-4.fc8 set to be updated
---> Package apr-devel.ppc 0:1.2.11-2 set to be updated
---> Package apr-util-devel.ppc 0:1.2.10-2.fc8 set to be updated
--> Processing Dependency: openldap-devel for package: apr-util-devel
--> Processing Dependency: db4-devel for package: apr-util-devel
--> Processing Dependency: expat-devel for package: apr-util-devel
--> Running transaction check
---> Package expat-devel.ppc 0:2.0.1-2 set to be updated
---> Package openldap-devel.ppc 0:2.3.39-1.fc8 set to be updated
--> Processing Dependency: cyrus-sasl-devel >= 2.1 for package: openldap-devel
---> Package db4-devel.ppc 0:4.6.21-1.fc8 set to be updated
--> Processing Dependency: libdb_cxx-4.6.so for package: db4-devel
--> Running transaction check
---> Package cyrus-sasl-devel.ppc 0:2.1.22-8.fc8 set to be updated
--> Processing Dependency: cyrus-sasl-lib = 2.1.22-8.fc8 for package: cyrus-sasl-devel
---> Package db4-cxx.ppc 0:4.6.21-1.fc8 set to be updated
--> Running transaction check
---> Package cyrus-sasl-lib.ppc 0:2.1.22-8.fc8 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 httpd-devel             ppc        2.2.6-3          fedora            144 k
Installing for dependencies:
 apr-devel               ppc        1.2.11-2         fedora            167 k
 apr-util-devel          ppc        1.2.10-2.fc8     fedora             55 k
 cyrus-sasl-devel        ppc        2.1.22-8.fc8     updates           357 k
 db4-cxx                 ppc        4.6.21-1.fc8     fedora            679 k
 db4-devel               ppc        4.6.21-1.fc8     fedora            2.6 M
 expat-devel             ppc        2.0.1-2          fedora            139 k
 openldap-devel          ppc        2.3.39-1.fc8     updates           1.6 M
 pkgconfig               ppc        1:0.22-4.fc8     updates            72 k
Updating for dependencies:
 cyrus-sasl-lib          ppc        2.1.22-8.fc8     updates           1.2 M

Transaction Summary
=============================================================================
Install      9 Package(s)
Update       1 Package(s)
Remove       0 Package(s)

Total download size: 7.0 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: pkgconfig                    ####################### [ 1/12]
  Updating  : cyrus-sasl-lib               ####################### [ 2/12]
  Installing: apr-devel                    ####################### [ 3/12]
  Installing: cyrus-sasl-devel             ####################### [ 4/12]
  Installing: openldap-devel               ####################### [ 5/12]
  Installing: expat-devel                  ####################### [ 6/12]
  Installing: db4-cxx                      ####################### [ 7/12]
  Installing: db4-devel                    ####################### [ 8/12]
  Installing: apr-util-devel               ####################### [ 9/12]
  Installing: httpd-devel                  ####################### [10/12]
  Cleanup   : cyrus-sasl-lib               ####################### [11/12]
  Cleanup   : cyrus-sasl-lib               ####################### [12/12]

Installed: httpd-devel.ppc 0:2.2.6-3
Dependency Installed: apr-devel.ppc 0:1.2.11-2 apr-util-devel.ppc 0:1.2.10-2.fc8 cyrus-sasl-devel.ppc 0:2.1.22-8.fc8 db4-cxx.ppc 0:4.6.21-1.fc8 db4-devel.ppc 0:4.6.21-1.fc8 expat-devel.ppc 0:2.0.1-2 openldap-devel.ppc 0:2.3.39-1.fc8 pkgconfig.ppc 1:0.22-4.fc8
Dependency Updated: cyrus-sasl-lib.ppc 0:2.1.22-8.fc8
Complete!

次にmod_encodingをダウンロードします。

[root@KURO-F7 ~]# wget http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
--12:21:56--  http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
           => `mod_encoding-20021209.tar.gz'
webdav.todo.gr.jp をDNSに問いあわせています... 61.197.226.211
webdav.todo.gr.jp|61.197.226.211|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 260,587 (254K) [application/x-gzip]

100%[====================================================================================================================>] 260,587      903.36K/s

12:21:56 (902.39 KB/s) - `mod_encoding-20021209.tar.gz' を保存しました [260587/260587]

Apache2版のmod_encodingをダウンロードします。

[root@KURO-F7 ~]# wget http://webdav.todo.gr.jp/download/experimental/mod_encoding.c.apache2.20040616
--12:22:51--  http://webdav.todo.gr.jp/download/experimental/mod_encoding.c.apache2.20040616
           => `mod_encoding.c.apache2.20040616'
webdav.todo.gr.jp をDNSに問いあわせています... 61.197.226.211
webdav.todo.gr.jp|61.197.226.211|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 16,954 (17K) [text/plain]

100%[====================================================================================================================>] 16,954        --.--K/s

12:22:52 (324.96 KB/s) - `mod_encoding.c.apache2.20040616' を保存しました [16954/16954]

ダウンロードしたmod_encodingを展開します。

[root@KURO-F7 ~]# tar xvzf mod_encoding-20021209.tar.gz
mod_encoding-20021209/
mod_encoding-20021209/lib/
mod_encoding-20021209/lib/NEWS
mod_encoding-20021209/lib/cp.h
mod_encoding-20021209/lib/iconv_hook_ja_auto.c
mod_encoding-20021209/lib/iconv_hook_default.c
mod_encoding-20021209/lib/aclocal.m4
mod_encoding-20021209/lib/iconv_hook_eucjp.c
mod_encoding-20021209/lib/README.JP
mod_encoding-20021209/lib/README
mod_encoding-20021209/lib/ltmain.sh
mod_encoding-20021209/lib/configure
mod_encoding-20021209/lib/identify_encoding.c
mod_encoding-20021209/lib/identify_encoding.h
mod_encoding-20021209/lib/iconv_hook_mssjis.c
mod_encoding-20021209/lib/iconv_hook_utf8_cp932.c
mod_encoding-20021209/lib/configure.in
mod_encoding-20021209/lib/config.guess
mod_encoding-20021209/lib/install-sh
mod_encoding-20021209/lib/config.sub
mod_encoding-20021209/lib/missing
mod_encoding-20021209/lib/iconv_hook.c
mod_encoding-20021209/lib/iconv_hook.h
mod_encoding-20021209/lib/mkinstalldirs
mod_encoding-20021209/lib/Makefile.am
mod_encoding-20021209/lib/Makefile.in
mod_encoding-20021209/lib/config.h.in
mod_encoding-20021209/lib/ucs2_cp932.h
mod_encoding-20021209/lib/stamp-h.in
mod_encoding-20021209/lib/AUTHORS
mod_encoding-20021209/lib/iconv_hook_utf8_eucjp.c
mod_encoding-20021209/lib/INSTALL
mod_encoding-20021209/lib/iconv.h.replace
mod_encoding-20021209/lib/iconv_hook_ucs2_cp932.c
mod_encoding-20021209/lib/ChangeLog
mod_encoding-20021209/lib/acconfig.h
mod_encoding-20021209/lib/COPYING
mod_encoding-20021209/NEWS
mod_encoding-20021209/mod_encoding.c
mod_encoding-20021209/aclocal.m4
mod_encoding-20021209/README.JP
mod_encoding-20021209/README
mod_encoding-20021209/configure
mod_encoding-20021209/configure.in
mod_encoding-20021209/install-sh
mod_encoding-20021209/Makefile.simple
mod_encoding-20021209/missing
mod_encoding-20021209/mkinstalldirs
mod_encoding-20021209/Makefile.am
mod_encoding-20021209/Makefile.in
mod_encoding-20021209/config.h.in
mod_encoding-20021209/stamp-h.in
mod_encoding-20021209/AUTHORS
mod_encoding-20021209/INSTALL
mod_encoding-20021209/ChangeLog
mod_encoding-20021209/acconfig.h
mod_encoding-20021209/COPYING

Apache2版mod_encodingに差し替えます。

[root@KURO-F7 ~]# cp mod_encoding.c.apache2.20040616 mod_encoding-20021209/mod_encoding.c
cp: `mod_encoding-20021209/mod_encoding.c' を上書きしてもよろしいですか(yes/no)? Y

mod_encodingのmakeとinstallを行います。
libディレクトリに移動し、configure & make & make install でOKです。

[root@KURO-F7 ~]# cd mod_encoding-20021209/lib

[root@KURO-F7 lib]# ./configure
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... missing
checking for working autoconf... missing
checking for working automake... missing
checking for working autoheader... missing
checking for working makeinfo... missing
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking whether make sets ${MAKE}... (cached) yes
checking for gcc option to accept ANSI C... none needed
checking for a BSD compatible install... /usr/bin/install -c
checking for Cygwin environment... no
checking for mingw32 environment... no
checking how to run the C preprocessor... gcc -E
checking host system type... powerpc-unknown-linux-gnu
checking build system type... powerpc-unknown-linux-gnu
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking for a sed that does not truncate output... /bin/sed
checking whether ln -s works... yes
checking how to recognise dependant libraries... pass_all
checking for object suffix... o
checking for executable suffix... no
checking command to parse /usr/bin/nm -B output... ok
checking for dlfcn.h... yes
checking for ranlib... ranlib
checking for strip... strip
checking for objdir... .libs
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.lo... yes
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking whether the linker (/usr/bin/ld) supports shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether -lc should be explicitly linked in... no
creating libtool
checking whether to use iconv(3) as a fallback converter... yes
checking for iconv.h... yes
checking for iconv in -liconv... no
checking for libiconv in -liconv... no
updating cache ./config.cache
creating ./config.status
creating Makefile
creating config.h


[root@KURO-F7 lib]# make
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c iconv_hook.c
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook.pp -c iconv_hook.c  -fPIC -DPIC -o .libs/iconv_hook.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook.pp -c iconv_hook.c -o iconv_hook.o >/dev/null 2>&1
mv -f .libs/iconv_hook.lo iconv_hook.lo
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c iconv_hook_default.c
rm -f .libs/iconv_hook_default.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_default.pp -c iconv_hook_default.c  -fPIC -DPIC -o .libs/iconv_hook_default.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_default.pp -c iconv_hook_default.c -o iconv_hook_default.o >/dev/null 2>&1
mv -f .libs/iconv_hook_default.lo iconv_hook_default.lo
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c iconv_hook_eucjp.c
rm -f .libs/iconv_hook_eucjp.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_eucjp.pp -c iconv_hook_eucjp.c  -fPIC -DPIC -o .libs/iconv_hook_eucjp.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_eucjp.pp -c iconv_hook_eucjp.c -o iconv_hook_eucjp.o >/dev/null 2>&1
mv -f .libs/iconv_hook_eucjp.lo iconv_hook_eucjp.lo
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c iconv_hook_ja_auto.c
rm -f .libs/iconv_hook_ja_auto.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_ja_auto.pp -c iconv_hook_ja_auto.c  -fPIC -DPIC -o .libs/iconv_hook_ja_auto.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_ja_auto.pp -c iconv_hook_ja_auto.c -o iconv_hook_ja_auto.o >/dev/null 2>&1
mv -f .libs/iconv_hook_ja_auto.lo iconv_hook_ja_auto.lo
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c iconv_hook_mssjis.c
rm -f .libs/iconv_hook_mssjis.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_mssjis.pp -c iconv_hook_mssjis.c  -fPIC -DPIC -o .libs/iconv_hook_mssjis.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_mssjis.pp -c iconv_hook_mssjis.c -o iconv_hook_mssjis.o >/dev/null 2>&1
mv -f .libs/iconv_hook_mssjis.lo iconv_hook_mssjis.lo
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c iconv_hook_ucs2_cp932.c
rm -f .libs/iconv_hook_ucs2_cp932.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_ucs2_cp932.pp -c iconv_hook_ucs2_cp932.c  -fPIC -DPIC -o .libs/iconv_hook_ucs2_cp932.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_ucs2_cp932.pp -c iconv_hook_ucs2_cp932.c -o iconv_hook_ucs2_cp932.o >/dev/null 2>&1
mv -f .libs/iconv_hook_ucs2_cp932.lo iconv_hook_ucs2_cp932.lo
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c iconv_hook_utf8_cp932.c
rm -f .libs/iconv_hook_utf8_cp932.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_utf8_cp932.pp -c iconv_hook_utf8_cp932.c  -fPIC -DPIC -o .libs/iconv_hook_utf8_cp932.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_utf8_cp932.pp -c iconv_hook_utf8_cp932.c -o iconv_hook_utf8_cp932.o >/dev/null 2>&1
mv -f .libs/iconv_hook_utf8_cp932.lo iconv_hook_utf8_cp932.lo
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c iconv_hook_utf8_eucjp.c
rm -f .libs/iconv_hook_utf8_eucjp.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_utf8_eucjp.pp -c iconv_hook_utf8_eucjp.c  -fPIC -DPIC -o .libs/iconv_hook_utf8_eucjp.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/iconv_hook_utf8_eucjp.pp -c iconv_hook_utf8_eucjp.c -o iconv_hook_utf8_eucjp.o >/dev/null 2>&1
mv -f .libs/iconv_hook_utf8_eucjp.lo iconv_hook_utf8_eucjp.lo
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c identify_encoding.c
rm -f .libs/identify_encoding.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/identify_encoding.pp -c identify_encoding.c  -fPIC -DPIC -o .libs/identify_encoding.lo
identify_encoding.c: In function 'is_eucjp':
identify_encoding.c:94: warning: comparison is always true due to limited range of data type
identify_encoding.c:98: warning: comparison is always true due to limited range of data type
identify_encoding.c:107: warning: comparison is always true due to limited range of data type
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wp,-MD,.deps/identify_encoding.pp -c identify_encoding.c -o identify_encoding.o >/dev/null 2>&1
mv -f .libs/identify_encoding.lo identify_encoding.lo
/bin/sh ./libtool --mode=link gcc  -g -O2  -o libiconv_hook.la -rpath /usr/local/lib -version-info 1:0:0 iconv_hook.lo iconv_hook_default.lo iconv_hook_eucjp.lo iconv_hook_ja_auto.lo iconv_hook_mssjis.lo iconv_hook_ucs2_cp932.lo iconv_hook_utf8_cp932.lo iconv_hook_utf8_eucjp.lo identify_encoding.lo
rm -fr .libs/libiconv_hook.la .libs/libiconv_hook.* .libs/libiconv_hook.*
gcc -shared  iconv_hook.lo iconv_hook_default.lo iconv_hook_eucjp.lo iconv_hook_ja_auto.lo iconv_hook_mssjis.lo iconv_hook_ucs2_cp932.lo iconv_hook_utf8_cp932.lo iconv_hook_utf8_eucjp.lo identify_encoding.lo   -Wl,-soname -Wl,libiconv_hook.so.1 -o .libs/libiconv_hook.so.1.0.0
(cd .libs && rm -f libiconv_hook.so.1 && ln -s libiconv_hook.so.1.0.0 libiconv_hook.so.1)
(cd .libs && rm -f libiconv_hook.so && ln -s libiconv_hook.so.1.0.0 libiconv_hook.so)
ar cru .libs/libiconv_hook.a  iconv_hook.o iconv_hook_default.o iconv_hook_eucjp.o iconv_hook_ja_auto.o iconv_hook_mssjis.o iconv_hook_ucs2_cp932.o iconv_hook_utf8_cp932.o iconv_hook_utf8_eucjp.o identify_encoding.o
ranlib .libs/libiconv_hook.a
creating libiconv_hook.la
(cd .libs && rm -f libiconv_hook.la && ln -s ../libiconv_hook.la libiconv_hook.la)


[root@KURO-F7 lib]# make install
make[1]: ディレクトリ `/root/mod_encoding-20021209/lib' に入ります
/bin/sh ./mkinstalldirs /usr/local/lib
/bin/sh ./libtool  --mode=install /usr/bin/install -c libiconv_hook.la /usr/local/lib/libiconv_hook.la
/usr/bin/install -c .libs/libiconv_hook.so.1.0.0 /usr/local/lib/libiconv_hook.so.1.0.0
(cd /usr/local/lib && rm -f libiconv_hook.so.1 && ln -s libiconv_hook.so.1.0.0 libiconv_hook.so.1)
(cd /usr/local/lib && rm -f libiconv_hook.so && ln -s libiconv_hook.so.1.0.0 libiconv_hook.so)
/usr/bin/install -c .libs/libiconv_hook.lai /usr/local/lib/libiconv_hook.la
/usr/bin/install -c .libs/libiconv_hook.a /usr/local/lib/libiconv_hook.a
ranlib /usr/local/lib/libiconv_hook.a
chmod 644 /usr/local/lib/libiconv_hook.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/bin/sh ./mkinstalldirs /usr/local/include/iconv_hook
mkdir /usr/local/include/iconv_hook
 /usr/bin/install -c -m 644 iconv_hook.h /usr/local/include/iconv_hook/iconv_hook.h
make  install-data-hook
make[2]: ディレクトリ `/root/mod_encoding-20021209/lib' に入ります
/usr/bin/install -c -m 644 iconv.h.replace /usr/local/include/iconv_hook/iconv.h
make[2]: ディレクトリ `/root/mod_encoding-20021209/lib' から出ます
make[1]: ディレクトリ `/root/mod_encoding-20021209/lib' から出ます

mod_encodingにパッチを当てます。

パッチのダウンロード
[root@KURO-F7 mod_encoding-20021209]# wget http://www.aconus.com/~oyaji/faq/mod_encoding.c-apache2.2-20060520.patch
--13:29:55--  http://www.aconus.com/~oyaji/faq/mod_encoding.c-apache2.2-20060520.patch
           => `mod_encoding.c-apache2.2-20060520.patch'
www.aconus.com をDNSに問いあわせています... 124.25.221.221
www.aconus.com|124.25.221.221|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 3,591 (3.5K) [text/plain]

100%[====================================================================================================================>] 3,591         --.--K/s

13:29:56 (23.46 MB/s) - `mod_encoding.c-apache2.2-20060520.patch' を保存しました [3591/3591]

patch実施
[root@KURO-F7 mod_encoding-20021209]# patch -p0 < mod_encoding.c-apache2.2-20060520.patch
patching file mod_encoding.c

configure実施
[root@KURO-F7 mod_encoding-20021209]# ./configure --with-apxs=/usr/sbin/apxs --with-iconv-hook
loading cache ./config.cache
checking for a BSD compatible install... (cached) /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... (cached) no
checking for working aclocal... missing
checking for working autoconf... missing
checking for working automake... missing
checking for working autoheader... missing
checking for working makeinfo... missing
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether to compile with debug code... checking whether to wrap iconv with iconv_hook... yes
checking for iconv_hook in -liconv_hook... yes
checking for iconv in -liconv... (cached) no
checking for libiconv in -liconv... (cached) no
updating cache ./config.cache
creating ./config.status
creating Makefile
creating config.h
config.h is unchanged

Makefile編集
[root@KURO-F7 mod_encoding-20021209]# vi Makefile

LIBS =  -liconv_hook
↓このように書き換えます
LIBS =  -L/usr/local/lib -liconv_hook

install-exec-local:
        $(APXS) -i mod_encoding.so
        ↓このように書き換えます
        $(APXS) -i -a -n encoding mod_encoding.la


make実施
[root@KURO-F7 mod_encoding-20021209]# make
/usr/sbin/apxs -c  -I/usr/local/include/iconv_hook  -L/usr/local/lib -liconv_hook mod_encoding.c
/usr/lib/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1 -I/usr/include/mysql -I/usr/local/include/iconv_hook  -c -o mod_encoding.lo mod_encoding.c && touch mod_encoding.slo
mod_encoding.c:362: warning: initialization from incompatible pointer type
mod_encoding.c:366: warning: initialization from incompatible pointer type
mod_encoding.c:370: warning: initialization from incompatible pointer type
mod_encoding.c:374: warning: initialization from incompatible pointer type
mod_encoding.c:378: warning: initialization from incompatible pointer type
/usr/lib/apr-1/build/libtool --silent --mode=link gcc -o mod_encoding.la  -L/usr/local/lib -liconv_hook -rpath /usr/lib/httpd/modules -module -avoid-version    mod_encoding.lo

install実施
[root@KURO-F7 mod_encoding-20021209]# make install
/usr/sbin/apxs -c  -I/usr/local/include/iconv_hook  -L/usr/local/lib -liconv_hook mod_encoding.c
/usr/lib/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1 -I/usr/include/mysql -I/usr/local/include/iconv_hook  -c -o mod_encoding.lo mod_encoding.c && touch mod_encoding.slo
mod_encoding.c:362: warning: initialization from incompatible pointer type
mod_encoding.c:366: warning: initialization from incompatible pointer type
mod_encoding.c:370: warning: initialization from incompatible pointer type
mod_encoding.c:374: warning: initialization from incompatible pointer type
mod_encoding.c:378: warning: initialization from incompatible pointer type
/usr/lib/apr-1/build/libtool --silent --mode=link gcc -o mod_encoding.la  -L/usr/local/lib -liconv_hook -rpath /usr/lib/httpd/modules -module -avoid-version    mod_encoding.lo
make[1]: ディレクトリ `/root/mod_encoding-20021209' に入ります
/usr/sbin/apxs -i -a -n encoding mod_encoding.la
/usr/lib/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib/apr-1/build/libtool' mod_encoding.la /usr/lib/httpd/modules
/usr/lib/apr-1/build/libtool --mode=install cp mod_encoding.la /usr/lib/httpd/modules/
cp .libs/mod_encoding.so /usr/lib/httpd/modules/mod_encoding.so
cp .libs/mod_encoding.lai /usr/lib/httpd/modules/mod_encoding.la
cp .libs/mod_encoding.a /usr/lib/httpd/modules/mod_encoding.a
chmod 644 /usr/lib/httpd/modules/mod_encoding.a
ranlib /usr/lib/httpd/modules/mod_encoding.a
PATH="$PATH:/sbin" ldconfig -n /usr/lib/httpd/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib/httpd/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/lib/httpd/modules/mod_encoding.so
[activating module `encoding' in /etc/httpd/conf/httpd.conf]
make[1]: `install-data-am' に対して行うべき事はありません.
make[1]: ディレクトリ `/root/mod_encoding-20021209' から出ます

mod_encodingの設定

mod_encodingの設定を行います。
設定ファイルは新規作成します。

[root@KURO-F7 ~]# vi /etc/httpd/conf.d/mod_encoding.conf

下記のように編集します。
EncodingEngine        on

SetServerEncoding     UTF-8

DefaultClientEncoding UTF-8 CP932 EUCJP-MS

AddClientEncoding "Microsoft .* DAV 1.1" ASCII CP932 UTF-8
AddClientEncoding "Microsoft .* DAV" UTF-8 CP932
AddClientEncoding "(Microsoft .* DAV $)" UTF-8 CP932
AddClientEncoding "(Microsoft .* DAV 1.1)" CP932 UTF-8
AddClientEncoding "Microsoft-WebDAV*" UTF-8 CP932
AddClientEncoding "RMA/*" CP932
AddClientEncoding "xdwin9x/" CP932
AddClientEncoding "cadaver/" UTF-8 EUCJP-MS
AddClientEncoding "Mozilla/" EUCJP-MS

NormalizeUsername on	←ホスト名を取り外して認証する	

Apacheの設定を反映します。

[root@KURO-F7 ~]# /etc/rc.d/init.d/httpd reload
httpd を再読み込み中:                                      [  OK  ]

WebDAVの設定

WebDAVの設定を行います。
設定ファイルは新規作成します。
"MS-Author-Via"というヘッダを付与することを指定します。
このヘッダを付与しないと、Webフォルダは正しく動作できません。

[root@KURO-F7 ~]# vi /etc/httpd/conf.d/webdav.conf

下記のように編集します。
Alias /webdav/ /home/public
<Location "/webdav/">
    DAV On
    SSLRequireSSL
    Options None
    AuthType Basic
    AuthName WebDAV
    AuthUserFile /etc/httpd/conf/.htpasswd
    Require user SambaUser
</Location>

<Location />
    Header add MS-Author-Via "DAV"
</Location>

<VirtualHost *:80>
    Redirect /webdav https://localhost/webdav
</VirtualHost>

Apacheを再起動します。

[root@KURO-F7 ~]# /etc/rc.d/init.d/httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]

WebDAV用ユーザーのパスワードを設定します。

[root@KURO-F7 ~]# htpasswd -b /etc/httpd/conf/.htpasswd SambaUser PASSWORD
Adding password for user SambaUser

スポンサード リンク

TOPに戻る / メニューに戻る
Copyright © 1999-2017 Amonution  All rights reserved.
Address