apacheの履歴

モジュールのマニュアル
http://httpd.apache.org/docs/2.2/ja/mod/

設定逆引き

phpファイルをテキストで表示

AddHandler text/plain .php

強制的にphpとして実行

ForceType application/x-httpd-php

.htaccessを許可/禁止する

AllowOverride All  # 許可
AllowOverride None # 禁止

ディレクトリアクセスしたときにindex.htmlを表示する

DirectoryIndex index.html

DocumentRootのディレクトリ以外を公開したい

Aliasを使う

Alias /hoge "/path/to/htdocs"

VirtualHostを使う

<VirtualHost 127.0.0.1>
  <Directory /path/to/htdocs>
     allow from all
  </Directory>
</VirtualHost>

ディレクトリアクセスしたときに中身を表示しない

Options -Indexes

Basic認証をかける

AuthType Basic
AuthName "authenticate required"
AuthUserFile /path/to/.htpasswd
Require valid-user

他の設定ファイルを読み込む

Include /path/to/another/httpd.conf

phpファイルだけに適用させる

<Files ~ "\.php$">
  ...
</Files>