補助設定ファイルの読み込み

広告

Apacheの以前のバージョンでは全ての設定を「httpd.conf」ファイルに記述していましたが、Apache2.2系からはいくつかの設定項目については別ファイルに分離し、必要に応じて「httpd.conf」に読み込むようになりました。

デフォルトで用意されている設定ファイルは「conf¥extra」ディレクトリに含まれています。

p2-1

元々「httpd.conf」ファイルにまとめて書かれていたものを別のファイルに分けたものですので、書式は「httpd.conf」と同じです。

では別のファイルをどのように読み込んでいるか確認してみます。「httpd.conf」ファイルをテキストエディタで開き、最後の方を見てください。次のような記述があります。

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be 
# included to add extra features or to modify the default configuration of 
# the server, or you may simply copy their contents here and change as 
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
#Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

「httpd.conf」ファイルでは先頭に「#」が記述された行はコメントとなります。現在は全ての行に「#」がついていますので外部にある設定ファイルは読み込まれていません。

例えばWebDAVに関する設定ファイルを読みこむようにするには次のように行頭の「#」を外します。

# Distributed authoring and versioning (WebDAV)
Include conf/extra/httpd-dav.conf

これで「httpd.conf」に「conf¥extra」ディレクトリにある「httpd-dav.conf」に記述された内容が読み込まれることになります。

※外部ファイルを読み込む「Include」については「設定ファイルの取込(Include)」を参照して下さい。

( Written by Tatsuo Ikura )