2004-07-18 Sun
Basic 認証をかけるが,特定のホストは認証なしで通過させる方法
AuthUserFile /path/to/.htpasswd AuthGroupFile /dev/null AuthName "Please enter username and password" AuthType Basic Require valid-user Satisfy any Order deny,allow Allow from 192.168.0.0/24 Deny from all
- Satisfyがキモらしい
| Satisfy all | Basic認証 and ホスト認証 の両方が通過しないとダメ.デフォルトはこっち. |
| Satisfy any | Basic認証 or ホスト認証 のどちらかが通過すれば OK. |
- Reference
cl.pocari.org - 2003-06-01
http://cl.pocari.org/2003-06.php#2003-06-01-1
ミケネコのhtaccessリファレンス
http://mikeneko.creator.club.ne.jp/~lab/web/htaccess/auth.html#Satisfy
2003-09-02 Tue
Apacheで 403 Fobbiden エラーが発生する問題
- 原因
実行属性がついていない
- 今回のケース
/home/yoshiki に実行属性がついていなかったため
/home/yoshiki/public_html
/home/yoshiki/example
にアクセス不可能
- /home/user ディレクトリ
デフォルトで実行権限がついていないので
せめて 701 に
2003-09-02 Tue
apache + libapache-mod-mp3 で Streaming Server
- インストール
# aptitude install libapache-mod-mp3
- 設定 /etc/apache/httpd.conf
LoadModule mp3_module /usr/lib/apache/1.3/mod_mp3.so <IfModule mod_mp3.c> Listen 8000 <VirtualHost _default_:8000> MP3Engine On MP3Random On MP3CastName "mod_mp3" MP3Genre "Sounds of Open Source" MP3 /archives/audio/mp3/ Timeout 1200 </VirtualHost> </IfModule>
- 聞く
$ mpg123 http://localhost:8000/
$ xmms http://localhost:8000/
- 使い勝手
コネクション毎に別の曲が流れるのでBroadCastというよりはOnDemandCastingか?
曲を選ぶことはできないが,次の曲に移ることはできる.
- Reference
infObsession linux memo
http://infobsession.dtdns.net/~ryu1/entity/linuxmemo.xhtml#id38
2003-06-20 Fri
spam アドレス収集 robot に対抗するための mod_rewrite
- 例
FreeBit.NE.JP からのアクセスで,
User Agent が `Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)'を /hoge.html に誘導
- httpd.conf に記述
RewriteCond %{HTTP_REFERER} ^$
RewriteCond %{REMOTE_HOST} \.FreeBit\.NE\.JP$ [NC]
RewriteCond %{HTTP_USER_AGENT} "^Mozilla/4.0 \(compatible; MSIE 6.0; Windows 98\)$"
RewriteRule ^.*$ /hoge.html [L]
- Reference
http://www.otsune.com/diary/2003/06/19.html#2003061927
2003-06-04 Wed
Securing Apache - Step-by-Step
- Summary
Apache の安全な運用法
- Reference
http://www.securityfocus.com/infocus/1694
2003-06-04 Wed
Installing and Securing the Apache Webserver with SSL
- Summary
SSL (mod_ssl) を用いた Apache の安全な運用法
- Reference
http://www.securityfocus.com/infocus/1356
2003-06-04 Wed
インデックス表示でファイル名が長いと隠れてしまう
- 原因
httpd.conf の IndexOptions の設定変更が必要
- 対処法
httpd.conf に
IndexOptions +NameWidth=*
を追加する.
- Reference
http://www.itmedia.co.jp/help/tips/linux/l0398.html
2003-06-04 Wed
モジュール一覧
- Apache モジュール一覧 (version 1.x)
http://httpd.apache.org/docs/mod/
- Apache モジュール一覧 (version 2.x)
http://httpd.apache.org/docs-2.0/ja/mod/
2003-05-25 Sun
Apache の Combine ログから worm のログを分離
- Summary
mod_setenvifを利用して Combine ログからwormのログを消去,worm用のログファイルに出力する.
画像やcssのログは記録しない.
awstatsのエラー回避のためにも有効.
# For Combining log files <IfModule mod_setenvif.c> SetEnvIf Request_URI "^/_mem_bin/" worm trash SetEnvIf Request_URI "^/_vti_bin/" worm trash SetEnvIf Request_URI "^/c/winnt" worm trash SetEnvIf Request_URI "^/c/winnt" worm trash SetEnvIf Request_URI "^/msadc/" worm trash SetEnvIf Request_URI "^/MSADC/" worm trash SetEnvIf Request_URI "^/scripts/" worm trash SetEnvIf Request_URI "^/default.ida" worm trash SetEnvIf Request_URI "Admin\.dll" worm trash SetEnvIf Request_URI "cmd\.exe" worm trash SetEnvIf Request_URI "null\.ida" worm trash SetEnvIf Request_URI "NULL\.IDA" worm trash SetEnvIf Request_URI "root\.exe" worm trash SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" trash SetEnvIf Request_URI "\.(js)|(css)|(ico)$" trash SetEnvIf Request_URI "/robots\.txt$" trash SetEnvIf Remote_Addr "127\.0\.0\.1" trash SetEnvIf Remote_Addr "^192\.168\.[0-9]+\.[0-9]+$" trash </IfModule> CustomLog /var/log/apache/access_log combined env=!worm CustomLog /var/log/apache/worm_log combined env=worm
- Reference
AWStats 6.0
http://cyberam.dip.jp/linux_server/log/awstats60_main.html#8
ITMedia - Developer - Linux Tips
http://www.itmedia.co.jp/help/tips/linux/l0324.html
2003-01-21 Tue
デフォルトのCharsetを変更する
- 方法
httpd.confを変更
# Default charset to iso-8859-1 (http://www.apache.org/info/css-security/). AddDefaultCharset on
を
AddDefaultCharset off
にする