IPアドレスでアクセス制限をかけたいと思います。
現在は、.htaccessで
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx
と制御しています。
これを、htaccessではなく、
httpd.confの設定で制御したいと思います。
管理上、VirtualHostないにかければ楽ですが、無理なら、ユーザーごと(もしくは、/home/*/public_html)でもいいです。
設定方法をご存知の方がいらっしゃいましたら、ご教授願います。
----------
<VirtualHost xxx.xxx.xxx.xxx>
ServerName hoge.example.com
DocumentRoot /home/hoge/public_html
</VirtualHost>
手元のapache2で試してみました。<Directory>内に記述すると成功します(というか元々そうしてあります)
<VirtualHost>内に書いたらconfigtestではねられました。
お役に立ちますでしょうか。
以下httpd.confの中身(関係ない部分は削除済み)
<VirtualHost host.example.jp>
DocumentRoot "/home/httpd/htdocs"
ここに書くと失敗します
<IfModule mod_userdir.c>
UserDir public_html
<Directory /home/*/public_html/>
AllowOverride None
AllowOverride None
Order allow,deny
Deny from host1.example.net host2.example.com asahi-np.co.jp
Allow from all
</Directory>
</IfModule>
</VirtualHost>
手元のapache2で試してみました。<Directory>内に記述すると成功します(というか元々そうしてあります)
<VirtualHost>内に書いたらconfigtestではねられました。
お役に立ちますでしょうか。
以下httpd.confの中身(関係ない部分は削除済み)
<VirtualHost host.example.jp>
DocumentRoot "/home/httpd/htdocs"
ここに書くと失敗します
<IfModule mod_userdir.c>
UserDir public_html
<Directory /home/*/public_html/>
AllowOverride None
AllowOverride None
Order allow,deny
Deny from host1.example.net host2.example.com asahi-np.co.jp
Allow from all
</Directory>
</IfModule>
</VirtualHost>
ありがとうございます。
早速やってみます。
Apacheの公式サイトにあるドキュメントが非常に秀逸ですから、参考にされるとよいですよ!(日本語です。)
http://httpd.apache.org/docs/2.0/mod/core.html#directory
で、肝心の記述方法ですが、httpd.conf内の<VirtualHost>内に、
<Directory /home/*/public_html>~</Directory>
と書いて、~部分に.htaccessの中身をそのまま書けばよさそうですがいかがでしょうか!
<VirtualHost xxx.xxx.xxx.xxx>
ServerName hoge.example.com
DocumentRoot /home/hoge/public_html
<Directory /home/*/public_html>
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx
</Directory>
</VirtualHost>
ありがとうございました。
ありがとうございます。
早速やってみます。