Apache の設定ファイルは、/etc/httpd/conf/httpd.conf です。この設定ファイルは、大きく 3 つのセクションに分けてディレクティブ(設定項目)が記述されています。以下は、/etc/httpd/conf/httpd.conf の一部を抜粋したものです。
### Section 1: Global Environment # # The directives in this section affect the overall operation of Apache, # such as the number of concurrent requests it can handle or where it # can find its configuration files. 省略 ### Section 2: 'Main' server configuration # # The directives in this section set up the values used by the 'main' # server, which responds to any requests that aren't handled by a # <VirtualHost> definition. These values also provide defaults for # any <VirtualHost> containers you may define later in the file. 省略 ### Section 3: Virtual Hosts # # VirtualHost: If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. 省略 |
各セクションの概要は、以下の通りです。
Apache サーバープロセスの全般的な制御(グローバルな設定)を行うためのディレクティブを指定します。
バーチャルホストでないメインサーバーの設定を行うためのディレクティブを指定します。なお、ここで指定した値は、バーチャルホストの初期値として反映されます。バーチャルホストとは物理的に一台のコンピュータで複数の Web サイトを公開するための機能です。
各バーチャルホスト毎の設定を行うためのディレクティブを指定します。
![]() | Apache1.3.4 より前のバージョンでは、基本設定を行う httpd.conf の他に、アクセス制御の設定を行う access.conf、HTML ドキュメントに関する設定を行う srm.conf の 3 つの設定ファイルが存在しました。バージョン 1.3.4 以降、access.conf と srm.conf の内容は全て httpd.conf に統合されています。Apache2.0 では、これらのファイルを取り込むための AccessConfig ディレクティブと ResourceConfig ディレクティブが存在しません。以前と同様にこれらのファイルを読み込んで使用したい場合、/etc/httpd/conf/httpd.conf の最後に srm.conf、access.conf の順にファイルを読み込むよう Include ディレクティブの指定を行う必要があります。 |