Apache | Apacheの基本設定 | 設定ファイルの読み込み(Include)

Apacheの構成で、Includeディレクティブを使って他の設定ファイルを読み込む方法について説明する。

Includeディレクティブ

Includeは、他の設定ファイルを読み込むときに使用する。

Include ファイル名

ファイル名は絶対パスで指定するか、ServerRootからの相対パスで指定する。

httpd.confファイルでIncludeを検索すると、次のような内容が見つかる。

# 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

# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf

現在はすべてコメントになっているが、httpd.conf以外に用意した設定ファイルをhttpd.confへ読み込みたい場合は、コメントを解除してIncludeを使用する。