22
29

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

初心者向けApache設定ファイルの見方

Last updated at Posted at 2016-06-07

ドキュメントルート(Document Root)

DocumentoRoot = http://localhost/
で置き換えられる部分のこと

DocumentRoot: /var/www/aaa
Request URL: http://localhost/index.html
実際のファイル: /var/www/aaa/index.html

サーバルート(Server Root)

Apacheが使用する様々な設定ファイルなどが置かれているディレクトリのこと

/etc/httpd/conf/httpd.conf内で相対パス記載されているものは、サーバルート以下で探すと見つかる

httpd.conf

Apacheの設定ファイル。
Directive(指示という意味)という構文を使って書かれている

  • ディレクティブは1行につき1つ
  • 大文字小文字の区別はない

ディレクティブ

ディレクティブは
全体の設定値(Apache全般に関わる設定)と
範囲指定の設定値(一部のファイル、ディレクトリ、モジュールに関する設定)
の2種類に分かれる

モジュール

Apacheはモジュール化されているので、機能を拡張するには、コアサーバにモジュールをロードさせなければならない。
モジュールはLoadModuleディレクティブを使用して追加できる
モジュールの設定はを使って、対象のモジュールが存在したときだけ、設定を反映させることができる

セクションコンテナ

ディレクティブで範囲指定を行うために、セクションコンテナを使う
例えばディレクトリのセクションコンテナなら

<Directory />
       Deny from All(ディレクティブの内容)
</ Directory>

その他のセクションコンテナは、

Directive mean
Directory \ 〜\ Directory\>のように、具体的なディレクトリを指定して使う。ワイルドカードを使用することもできる
<Directory
Match>
正規表現で指定されたディレクトリとサブディレクトリに適用される。<DirectoryMatch "^.*b$">
<Files> ファイルを指定する
<FilesMatch> 正規表現に一致するファイルを指定する
<Location> URLとして送られた文字列に適用される
<Location
Match>
URLに対する正規表現に適用される

ディレクティブの中身

Option mean
AllowOverride .htaccessで設定を上書きする、しない
Options 追加したいオプションをスペース区切りで続けていく
Order allow
,deny
アクセス制限関連
22
29
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
29

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?