Apacheの設定

メモ:  Category:kuro_box

ここでは、80と443(SSL)の両方を同一のサーバで動かすことを目標とします。 DocumentRootはそれぞれ用意します。

Could not determine the server’s full …の解消

玄Debianで、Apacheを起動すると「Could not determine the server’s full …」 と表示されていたので、まずこれを解消します。 これは、ApacheがServerNameを決定できなくて出ているようです。 そこで、httpd.confのServerNameを設定します。

ServerName aaa.bbb.net

参考:方法は2種類あるようです。

  1. /etc/hostsのlocalhost行にFQDNを指定する
  2. /etc/apache/httpd.confにServerNameディレクティブを指定する

ポートの変更

もし、身内のみの使用であれば

Listen 80 Listen 443

のポート番号を変更するのもいいですね。

DocumentRootの設定

私の場合、ユーザーで入ってホームページを触りたいので /home/webadmin/htdocsを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

mkdir ssldocs

Apacheの設定を変更します。

# vi http.conf

DocumentRoot /home/webadmin/htdocs

DocumentRootを変更したためディレクティブも変更します。 デフォルトでは<Directory “/usr/local/apache/htdocs”>となっています。

<Directory “/home/webadmin/htdocs”>

SSLの方も変更します。下記のDocumentRootを変更します。

DocumentRoot "/home/webadmin/ssldocs"

Copyright 1997-2010 BBB All rights reserved.

bluenote by BBB