玄箱 Debian に Apache2[2.2.3-4+etch1] をインストールします。今回の再構築では、PHP5の導入を 予定しており、libapache2-mod-php5のインストールを考えているためApacheは、apache2-mpm-prefork をインストールします。
$ su Password:(rootのパスワードを入力) # aptitude update # aptitude install apache2-mpm-prefork
インストールが完了したら、とりあえずクライアントからブラウザを使って玄箱へ接続してみます。
次のように表示されれば、正常に動作しています。
It works!
Webドキュメントの管理のために管理用ユーザを作成し、そのユーザーのホームディレクトリを DocumentRootへ設定します。
まず、管理用ユーザーを作成します。
# adduser webadmin Adding user webadmin... Adding new group webadmin (1001). Adding new user webadmin (1001) with group webadmin. Creating home directory /home/webadmin. Copying files from /etc/skel Enter new UNIX password: (新しいパスワードを入力) Retype new UNIX password: (同じものをもう一度入力) passwd: password updated successfully Changing the user information for hoge Enter the new value, or press return for the default Full Name []: (無視) Room Number []: (無視) Work Phone []: (無視) Home Phone []: (無視) Other []: (無視) Is the information correct? [y/n] y
webadminのhomeディレクトリにホームページ用のディレクトリを作成します。
# mkdir htdocs
DocumentRoot等を変更します。
# cd /etc/apache2/sites-available/ # cp default default.org # vi default
defaultファイルの以下の部分を修正します。
DocumentRoot /var/www/ ↓ DocumentRoot /home/webadmin/htdocs/ <Directory /var/www/> ↓ <Directory /home/webadmin/htdocs/> # --以下の行をコメントアウト又は削除 RedirectMatch ^/$ /apache2-default/
文字コードをメタタグの指定に任せるため apache2.conf を変更します。
# cd /etc/apache2/ # cp apache2.conf apache2.org # vi apache2.conf
以下の部分を修正
AddDefaultCharset off
ついでに日本語を優先するよう LanguagePriority のjpを先頭へ持ってきます。
LanguagePriority jp ・・・・・
設定が完了したらApache2を再起動します。
/etc/init.d/apache2 restart
再起動後次のようなWarningがでました。
apache2: Could not reliably determine the server's fully qualified domain name
apache2.confにServerNameが設定されていないので、ServerNameを設定します。
ServerName aaa.bbb.net
Apacheを再起動します。
Copyright 1997-2008 BBB All rights reserved.