YANO's digital garage

Copyright ©YANO All rights reserved. https://www.bravotouring.com/~yano/

Last-modified: 2024-03-20 (水)


[一語一絵]

レジストラ移管 / 2004-10-25 (月)

ドメインbravotouring.comのレジストラ(登録業者)を取得した[External]お名前.comから[External]ムームードメインに移管手続き。これで登録更新料が年間3,990円から、808円と75%OFFになればバンザイだ。

ちなみに[External]ムームードメインをやっている[External]株式会社paperboy&co.は、[External]お名前.comをやっている[External]グローバルメディアオンラインの子会社になってしまったので、親会社から子会社へ乗換えた事になる。

【参照】
●ムームードメイン https://muumuu-domain.com/


[一語一絵]

ライオンズ日本一 / 2004-10-25 (月)

台風や地震で文字通り水を差された感じだが、12年ぶりの日本チャンピオンおめでとう。取り敢えず堤オーナーの花道を飾れて良かったのではないかと思う。しかし毎試合、長かったなぁ。


[一語一絵/IT系]

Apache 1.3.32 Ready / 2004-10-25 (月)

22日に[External]Apacheの1.3系がアップデートされている。不正な Content-Length の応答処理の問題([External]CAN-2004-0492)が対処されたという事だ。足並み揃えて[External]mod_sslも2.8.21がリリースされたので、何はなくともアップデート。

【参照】
●Japan Apache Users Group http://www.apache.jp/
●mod_ssl http://www.modssl.org/


[一語一絵]

義援金の受付始まる / 2004-10-25 (月)


[一語一絵/IT系]

続:Fedora Core 2 〜 Apache 2.0.51の設定 / 2004-10-25 (月)

基本的な/etc/httpd/conf/httpd.confの編集をするなり。(サーバー名とかバーチャルホストの設定は省略)

何はともあれhttp://hostname/~hoge/を使う為にユーザーディレクトリを有効にする。

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid.  This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
#
<IfModule mod_userdir.c>
   #
   # UserDir is disabled by default since it can confirm the presence
   # of a username on the system (depending on home directory
   # permissions).
   #
   #UserDir disable

   #
   # To enable requests to /~user/ to serve the user's public_html
   # directory, remove the "UserDir disable" line above, and uncomment
   # the following line instead:
   #
   UserDir public_html

</IfModule>

TopページはCGIで振り分けているので、CGIハンドラも登録。

#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory /home/*/public_html>
   AllowOverride FileInfo AuthConfig Limit
#   Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
   Options SymLinksIfOwnerMatch IncludesNoExec ExecCGI
   <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
   </Limit>
#   <LimitExcept GET POST OPTIONS>
#        Order deny,allow
#        Deny from all
#   </LimitExcept>
</Directory>

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi

変更後の設定情報を反映するには

[root@fedora yano]# /sbin/service httpd reload
を叩くべし。

ブラウザを立ち上げてhttp://hostname/~hoge/にアクセスすると"403:Forbidden"が出たので、hogeディレクトリのパーミッションを700から755に変更。これで一歩前進したのだが今度は"500:Server Internal Error"に変った。perlのパスが違うかな?と思ったら案の定/usr/local/bin/perlが実在しなかったので、/usr/bin/perlから/usr/local/bin/perlへのシンボリックリンクを設定。

しかし残念ながらこれでも"500:Server Internal Error"は解決せず。もしやと思って

[root@fedora yano]# setenforce 0
でenforcing設定をpermissiveモードに切り替えて再度アクセスしたらビンゴ。期待通りTopページまで表示されたので、最後の壁はSELinuxのポリシーだ。というわけで"audit2allow -d -l"の出力から必要そうなhttpd_suexec_t行をコピーして、policy/domains に拡張子"te"のテキストファイルを作成し、make reloadする。
[root@fedora yano]# audit2allow -d -l
    :
allow httpd_suexec_t httpd_user_content_t:file { execute execute_no_trans getattr ioctl read };
allow httpd_suexec_t user_home_dir_t:dir { search };
    :
[root@fedora yano]# cd /etc/security/selinux/src/policy/domains
[root@fedora domains]# cat > httpd.te
allow httpd_suexec_t httpd_user_content_t:file { execute execute_no_trans getattr ioctl read };
allow httpd_suexec_t user_home_dir_t:dir { search };
[root@fedora domains]# cd ..
[root@fedora policy]# setenforce 1
[root@fedora policy]# make reload

しかし表示はされるようになったものの、[External]Firefoxでは文字セットがUTF-8として処理され日本語が文字化けしてしまった。メニューからISO-2022-JPを選択しなおせば大丈夫なので、単に文字セットを誤認しているだけだ。

HTMLコンテンツのMETAタグで文字セット(charset=ISO-2022-JP)の指定をしているのだが、HEADメソッドのレスポンスをチェックしたら"Content-Type text/html; charset=UTF-8;"が返されていた。調べたところ[External]Apacheの2.0から導入されたAddDefaultCharsetディレクティブが影響しているそうだ。

ちなみにディレクティブの説明文には「明示的に文字セットを指定していない応答に追加されるデフォルトの文字セット」と書かれてあるのでブラウザのバグかな?と思ったのだが、次の行には「ドキュメント内の META タグで指定されたどのような文字セット も無効にします」とも書かれてある。…デフォルトじゃないじゃん

ちなみに[External]Internet Explorerはこの場合でもMETAタグを優先してISO-2022-JPとして処理しており、仕様としてはMETAタグ優先の方が正しいような気がする。

というわけでAddDefaultCharsetディレクティブをOffに変更する為、再び/etc/httpd/conf/httpd.confを編集。

#
# Specify a default charset for all pages sent out. This is
# always a good idea and opens the door for future internationalisation
# of your web site, should you ever want it. Specifying it as
# a default does little harm; as the standard dictates that a page
# is in iso-8859-1 (latin1) unless specified otherwise i.e. you
# are merely stating the obvious. There are also some security
# reasons in browsers, related to javascript and URL parsing
# which encourage you to always set a default char set.
#
#AddDefaultCharset UTF-8
AddDefaultCharset Off
[External]Firefoxなどは毎回確認する前にブラウザ側のキャッシュをクリアしなくてはならない事に注意。

念の為LanguagePriorityディレクティブも、日本語を優先させる為にjaを先頭に移動。

#
# LanguagePriority allows you to give precedence to some languages
# in case of a tie during content negotiation.
#
# Just list the languages in decreasing order of preference. We have
# more or less alphabetized them here. You probably want to change this.
#
#LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
LanguagePriority ja en ca cs da de el eo es et fr he hr it ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

これで一段落。

PS. NTPサーバーの設定が/etc/ntp/step-tickersに変ってたよ、というメモ。

【参照】
●The Apache Software Foundation http://www.apache.org/
Apache HTTP サーバ バージョン 2.0 ドキュメント