「Apache」の版間の差分
提供: Wikinote
(→設定について) |
細 (→core を吐かせる) |
||
| (同じ利用者による、間の3版が非表示) | |||
| 行1: | 行1: | ||
| − | == | + | もう数年使ってるけどマジ初心者な Apache について。 |
| − | + | セキュリティのことを考えると、まずはじめに熟知しておくべきなのだが…。 | |
| − | + | ||
| − | + | == 設定 == | |
* <code>httpd -t</code> で設定の記述が正しいかテストできる。 | * <code>httpd -t</code> で設定の記述が正しいかテストできる。 | ||
| + | |||
| + | === core を吐かせる === | ||
| + | |||
| + | httpd は、RHEL の他のデーモンで必要となるような設定はなく、 | ||
| + | 以下のディレクティブを記載しておきさえすれば、core が吐かれるようだ。 | ||
| + | |||
| + | CoreDumpDirectory /tmp | ||
| + | |||
| + | ただ、kernel.core_pattern カーネルパラメータを、 | ||
| + | /var/core などパスにしていると吐かれないので注意すること。 | ||
| + | |||
| + | === リバースプロキシ === | ||
| + | |||
| + | * [http://httpd.apache.org/docs/2.2/ja/mod/mod_proxy.html mod_proxy - Apache HTTP サーバ] | ||
| + | |||
| + | ProxyRequests Off | ||
| + | |||
| + | <Proxy *> | ||
| + | Order deny,allow | ||
| + | Allow from all | ||
| + | </Proxy> | ||
| + | |||
| + | ProxyPass /foo http://foo.example.com/bar | ||
| + | ProxyPassReverse /foo http://foo.example.com/bar | ||
| + | |||
| + | === アクセス制限 === | ||
| + | ==== Basic 認証 ==== | ||
| + | Basic 認証では、パスワードは暗号化されないので、セキュリティ上はザルであることを認識しておくべきである。 | ||
| + | 単にちょっとアクセス制限をかける程度にしか使えないということ。 | ||
| + | |||
| + | まず、htpasswd でパスワードファイルを作成する。 | ||
| + | |||
| + | # htpasswd -c /path/to/passwd_file user_name | ||
| + | |||
| + | ほんで、/etc/httpd/conf/httpd.conf の Dicrectory セクションで以下のように設定する。 | ||
| + | |||
| + | <Directory "/path/to/secret_dir"> | ||
| + | AuthType Basic | ||
| + | AuthName "Secret Directory" | ||
| + | AuthUserFile /path/to/passwd_file | ||
| + | Require user user_name | ||
| + | </Directory> | ||
== このサイトの Apache について == | == このサイトの Apache について == | ||
| − | + | とりあえず編集した設定は: | |
| − | + | ||
ServerName hagio.org:80 | ServerName hagio.org:80 | ||
DocumentRoot "/home/hagio/public_html" | DocumentRoot "/home/hagio/public_html" | ||
| 行16: | 行57: | ||
$ chmod 711 /home/hagio | $ chmod 711 /home/hagio | ||
$ chmod 755 /home/hagio/public_html | $ chmod 755 /home/hagio/public_html | ||
| − | |||
| − | |||
| − | |||
2011年5月13日 (金) 20:58時点における最新版
もう数年使ってるけどマジ初心者な Apache について。 セキュリティのことを考えると、まずはじめに熟知しておくべきなのだが…。
設定
-
httpd -tで設定の記述が正しいかテストできる。
core を吐かせる
httpd は、RHEL の他のデーモンで必要となるような設定はなく、 以下のディレクティブを記載しておきさえすれば、core が吐かれるようだ。
CoreDumpDirectory /tmp
ただ、kernel.core_pattern カーネルパラメータを、 /var/core などパスにしていると吐かれないので注意すること。
リバースプロキシ
ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /foo http://foo.example.com/bar ProxyPassReverse /foo http://foo.example.com/bar
アクセス制限
Basic 認証
Basic 認証では、パスワードは暗号化されないので、セキュリティ上はザルであることを認識しておくべきである。 単にちょっとアクセス制限をかける程度にしか使えないということ。
まず、htpasswd でパスワードファイルを作成する。
# htpasswd -c /path/to/passwd_file user_name
ほんで、/etc/httpd/conf/httpd.conf の Dicrectory セクションで以下のように設定する。
<Directory "/path/to/secret_dir">
AuthType Basic
AuthName "Secret Directory"
AuthUserFile /path/to/passwd_file
Require user user_name
</Directory>
このサイトの Apache について
とりあえず編集した設定は:
ServerName hagio.org:80 DocumentRoot "/home/hagio/public_html" <Directory "/home/hagio/public_html"> ... DirectoryIndex intex.html index.html.var index.php
$ chmod 711 /home/hagio $ chmod 755 /home/hagio/public_html