猫、再来。

tmx2003-07-30











2003-07-29の続き。http://shebang.jp/src/apache/に惹かれつつも、どうせPostgreSQLしか使わない(この案件では)ので、さらにmod_auth_pgsql-0.9.12、インストールメモ。


~/work/mod_auth_pgsql-0.9.12以下で、
$./configure --with-apxs=/usr/local/apache/bin/apxs --with-pgsql=/usr/local/pgsql
して、makeしてsuしてmake install。

さらに、/usr/local/apache/conf/httpd.confを編集、と思ったらその必要無し。

認証をかけるための.htaccessはこんな感じ。


Auth_PG_host localhost
Auth_PG_port 5432
Auth_PG_database 手頃なDB
Auth_PG_user 手頃なDBと同じ
Auth_PG_pwd_table usersdb
Auth_PG_uid_field id
Auth_PG_pwd_field passwd
Auth_PG_encrypted off
Auth_PG_nopasswd off
Auth_PG_pwd_whereclause "and valid_flag = true"

AuthName "Please Enter Your Password"
AuthType basic


require valid-user

昨日と同様の方法で、CGI(Perl)とPHPから認証時のユーザ名が取れることを確認。

Auth_PG_pwd_whereclauseを、"and valid_flag = false"にしてみたりしてちゃんと効いてるコトを確認。

以上。


以下のWebページを参考にさせていただきました。

以下の書籍を参考にさせていただきました&昨日買いました。

ありがとうございます。


微妙なワナとして、UNIXドメイン経由の場合は下記の行はコメントアウトでOKです。
(というかコメントアウトしないとNGです。ちょっとハマりました。

#Auth_PG_host localhost
#Auth_PG_port 5432

あと、いつもpg_hba.confの場所を探して、いつもlocateで調べても見つからなくて(パーミッションのせいなのでrootかpostgresで調べれば見つかるんだけど)、なんで無いんだよとか言って、いつも悩むのでメモ。

/var/lib/pgsql/data/pg_hba.conf
Vine Linux 2.5CR付属のPostgreSQL7.2の場合。

以下のWebページを参考にさせていただきました。

ありがとうございます。

(10/16追記)

これで軽くなった! ような気がする...
さらに調子に乗って、mod_gzip-1.3.26.1a、インストールメモ。

~/work/mod_gzip-1.3.26.1a以下で、Makefileをちょっといぢる。


2c2< APXS?=/usr/local/apache/bin/apxs

    • -

> APXS?=/usr/local/sbin/apxs

makeしてsuしてmake install。

# mkdir /usr/local/apache/temp
# chown nobody.nobody /usr/local/apache/temp

テンポラリディレクトリを作る。
さらに、/usr/local/apache/conf/httpd.confを編集(下記を追加)。



LogFormat "%h %l %u %t \"%r\" %>s %b mod_gzip:%{mod_gzip_result}n In:%{mod_gzip_input_size}n Out:%{mod_gzip_output_siz\
e}n: %{mod_gzip_compression_ratio}npct." gzip_info
CustomLog /usr/local/apache/logs/gzip_log gzip_info
mod_gzip_on Yes
# mod_gzip_can_negotiate Yes
# mod_gzip_static_suffix .gz
# AddEncoding gzip .gz
# mod_gzip_update_static No
mod_gzip_dechunk Yes
mod_gzip_keep_workfiles No
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 600000
mod_gzip_temp_dir /usr/local/apache/temp/
# mod_gzip_handle_methods GET POST
mod_gzip_item_include mime ^application/x-httpd-cgi
mod_gzip_item_include mime ^application/x-httpd-php
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^perl-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include file \.shtml$
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.txt$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.cgi$
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude file \.css$
mod_gzip_item_exclude file \.js$
# mod_gzip_min_http 1001

(試行錯誤の上とりあえず、こんな感じ。

で、あぱっち再起動。
ブラウザからアクセスしてみる。

$ tail /usr/local/apache/logs/gzip_log

してみる。


192.168.0.216 - - [30/Jul/2003:18:54:28 +0900] "GET /test.php HTTP/1.1" 200 5936 mod_gzip:DECHUNK:OK In:51153 Out:5936: 89
pct.

圧縮されてるげなのでOK。

以上。


以下のWebページ&書籍を参考にさせていただきました。

ありがとうございます。

しかしなー、Norton InternetSecurity2003のセキュリティ設定がONになってるせいで、DECLINED:NO_ACCEPT_ENCODINGになってしまう(=ブラウザがAccept-Encodingヘッダで圧縮非対応を返す)のは、なかなか気付かなかった&ちょっとショック。

まあ、気持ちは分かるけど、ますますInternetSecurityがキライに...
(あ。Norton AntiVirusは好きです。毎年新しいヤツ買ってます。