Apache | Apacheの基本設定 | サーバー配置ディレクトリ(ServerRoot)
Apacheの設定で、サーバーの配置ディレクトリ(ServerRoot)を設定する方法について説明する。
ServerRootディレクティブ
ServerRootは、Apacheがインストールされているディレクトリである。
ServerRoot ディレクトリ
httpd.confファイルでServerRootを検索すると、次のような内容が見つかる。
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used. If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
Define SRVROOT "c:/Apache24"
ServerRoot "${SRVROOT}"
SRVROOTという変数でディレクトリを指定し、ServerRootで使用している。デフォルトではc:/Apache24になっているため、変更する場合は新しいディレクトリを指定する。末尾に/を付けないよう注意する。
Apacheの各種設定で絶対パスではなく相対パスが書かれている場合、ServerRootに指定されたディレクトリからの相対パスになる。たとえばErrorLogの設定部分を見てみる。
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error.log"
このように相対パスで書かれている場合、ServerRootの値がc:/Apache24であれば、実際に指すファイルはc:/Apache24/logs/error.logになる。