「Apache」の版間の差分
提供: Wikinote
(→設定について) |
|||
| 行1: | 行1: | ||
| − | == | + | もう数年使ってるけどマジ初心者な Apache について。 |
| − | + | セキュリティのことを考えると、まずはじめに熟知しておくべきなのだが…。 | |
| − | + | ||
| − | + | == 設定 == | |
* <code>httpd -t</code> で設定の記述が正しいかテストできる。 | * <code>httpd -t</code> で設定の記述が正しいかテストできる。 | ||
| + | |||
| + | === アクセス制限 === | ||
| + | ==== 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: | 行33: | ||
$ chmod 711 /home/hagio | $ chmod 711 /home/hagio | ||
$ chmod 755 /home/hagio/public_html | $ chmod 755 /home/hagio/public_html | ||
| − | |||
| − | |||
| − | |||
2009年12月4日 (金) 20:19時点における版
もう数年使ってるけどマジ初心者な Apache について。 セキュリティのことを考えると、まずはじめに熟知しておくべきなのだが…。
設定
-
httpd -tで設定の記述が正しいかテストできる。
アクセス制限
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