mod_gzipで。。。
SSLのWebサイトへアクセスすると
[error] mod_gzip: EMPTY FILE [/tmp/mod_gzip/_14197_391_292.wrk] in sendfile2
[error] mod_gzip: Make sure all named directories exist and have the correct permissions.
[error] mod_gzip: EMPTY FILE [/tmp/mod_gzip/_14189_481_382.wrk] in sendfile2
[error] mod_gzip: Make sure all named directories exist and have the correct
permissions.
の様なエラーが出たりとかしたり
mod_gzip自体で
[error] mod_gzip: TRANSMIT_ERROR:104
[error] mod_gzip: TRANSMIT_ERROR:ISMEM:104
[error] mod_gzip: TRANSMIT_ERROR:32
の様なエラーが頻発している。。。
SSL通信時にmod_gzipが機能しない にいろいろ書いてありました。
この機会にと思い、思い切ってApache2.x系に移行することを決意した。
#mod_gzipってApacheの1系のモジュールなんでしょ?
#何でこんなエラーが?(^^;
一応、/etc/httpd/conf/htpd.conf のバックアップを取っておく。
#cp etc/httpd/conf/htpd.conf /etc/httpd/conf/htpd.conf .20061224
apache1.3をアンインストール
# apt-get remove apache
パッケージリストを読みこんでいます... 完了
依存情報ツリーを作成しています... 完了
以下の追加パッケージがインストールされます:
apache2 apache2-apr openldap
以下のパッケージが削除されます:
apache mod_ssl php-apache
以下のパッケージが新たにインストールされます:
apache2 apache2-apr openldap
アップグレード: 0 個, 新規インストール: 3 個, 削除: 3 個, 保留: 1 個
2138kB のアーカイブを取得する必要があります。
展開後に 738kB が解放されます。
続行しますか? [Y/n]y
取得:1 http://updates.vinelinux.org 3.2/i386/plus apache2-apr 2.0.55-0vl1.2 [99.2kB]
取得:2 http://updates.vinelinux.org 3.2/i386/plus openldap 2.1.30-0vl1 [581kB]
取得:3 http://updates.vinelinux.org 3.2/i386/plus apache2 2.0.55-0vl1.2 [1458kB]
2138kB を 1s 秒で取得しました (1212kB/s)
変更を適用しています...
準備中... ########################################### [100%]
warning: /etc/httpd/conf.d/php.conf saved as /etc/httpd/conf.d/php.conf.rpmsave
warning: /etc/logrotate.d/apache saved as /etc/logrotate.d/apache.rpmsave
warning: /etc/httpd/conf/srm.conf saved as /etc/httpd/conf/srm.conf.rpmsave
warning: /etc/httpd/conf/httpd.conf saved as /etc/httpd/conf/httpd.conf.rpmsave
1:apache2-apr ########################################### [ 33%]
2:openldap ########################################### [ 66%]
3:apache2 ########################################### [100%]
完了
以前の1.3系の設定ファイルが.rpmsaveの拡張子でそれぞれ保存されたようだ。
# vi /etc/apache2/conf/httpd.conf ← Apache2の設定ファイル編集
ServerTokens Prod ← エラーページでOS名を非表示にする
ServerAdmin webmaster@hogehoge.com ← 管理者のメールアドレス
ServerName hogehoge.com:80 ← #を削除して自分のドメイン名を指定(※ドメインの後に「:80」 を付す)
DocumentRoot "/home/httpd/html" ← ドキュメントルートをVine標準の場所に設定
<Directory "/home/httpd/html"> ← ディレクトリをVine標準の場所に設定
Options Includes ExecCGI FollowSymLinks ← Indexesを削除してSSIとCGIを有効に
AllowOverride ← .htaccessの有効化
DirectoryIndex index.html index.htm index.shtml index.php index.cgi ← インデックスファイルを設定
WebDAVの脆弱性を狙った攻撃への対策
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
↓
LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
※ 追記 (wormからのアクセスをログに記録しない対策)
SetEnvIf Request_URI "cmd\.exe" nolog
SetEnvIf Request_URI "root\.exe" nolog
SetEnvIf Request_URI "Admin\.dll" nolog
SetEnvIf Request_URI "NULL\.IDA" nolog
SetEnvIf Request_URI "^/_mem_bin/" nolog
SetEnvIf Request_URI "^/_vti_bin/" nolog
SetEnvIf Request_URI "^/c/" nolog
SetEnvIf Request_URI "^/d/" nolog
SetEnvIf Request_URI "^/msadc/" nolog
SetEnvIf Request_URI "^/MSADC/" nolog
SetEnvIf Request_URI "^/scripts/" nolog
SetEnvIf Request_URI "^/default.ida" nolog
※ 追記 (gif,jpg,png,ico,cssへのアクセスをログに記録しない対策)
SetEnvIf Request_URI "\.(gif)|(jpg)|(png)|(ico)|(css)$" nolog
※ 追記 (内部からのアクセスをログに記録しない対策)
SetEnvIf Remote_Addr 192.168.11. nolog
CustomLog logs/access_log combined env=!nolog ← env=!nologを追記
ServerSignature off ← off指定でエラーページでApacheのバージョン非表示
#ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" ← # を追記(コメントアウト)
#AddDefaultCharset ISO-8859-1 ← #を追記(コメントアウト)
AddHandler cgi-script .cgi .pl ← #を削除して .plを追加
# service apache2 restart ← 設定終了後に再起動で設定反映
httpdを停止中: [ OK ]
httpdを起動中: [ OK ]
などと設定しapacheを再起動させ反映させる。
続いてバーチャルホストの設定。
# vi /etc/apache2/conf/httpd.conf ← 設定ファイル編集
#UserDir disable ← # を追記(コメントアウト)
UserDir public_html ← # を削除(コメント)
下記部分の先頭の# を削除
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews SymLinksIfOwnerMatch IncludesNoExec ← Indexesを削除
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
ユーザーのCGI専用ディレクトリの設定
#ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" ← # を追記(コメントアウト)
下記の部分の先頭に# を追記(コメントアウト)
#<Directory "/var/www/cgi-bin">
# AllowOverride None
# Options None
# Order allow,deny
# Allow from all
#</Directory>
※下記を追記
<Directory /home/*/public_html/cgi-bin>
AllowOverride FileInfo AuthConfig Limit
Options ExecCGI ← CGIを有効
Order allow,deny
Allow from all
</Directory>
# service apache2 restart
ここまでは良い感じ♪
<VirtualHost>ディレクティブにユーザーを設定しそのログの設定を試みる。。。
<VirtualHost IPアドレス:80>
ServerAdmin e-mail@hogehoge.com
DocumentRoot /home/ユーザ名/public_html
ServerName ユーザ名.net
ErrorLog logs/ユーザ名/error_log
CustomLog logs/ユーザ名/access_log combined env=!nolog
<Directory /home/ユーザ名/public_html/cgi-bin>
AllowOverride FileInfo AuthConfig Limit
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
#service apache2 restart
エラー。。。。。(´・ω・`)ショボーン
やっぱしかっ!!!
ここからスゲーはまった。。。orz
ここにも。。。。
ErrorLog logs/ユーザ名/error_log
CustomLog logs/ユーザ名/access_log combined env=!nolog
なんて書いてあるから絶対間違いないって疑いもしなかった。。。(ノД`)シクシク
ログファイルを直接指定したらどうなるかなって。。。
ErrorLog /var/log/apache2/ユーザ名/error_log
CustomLog /var/log/apache2/ユーザ名/access_log combined env=!nolog
案の定ビンゴw
。。。でも何でダメだったんだろ?(゜∀゜)
あとはログローテなどの設定をすればOK♪
apache1.3系のログを。。。
# mv /var/log/httpd/* /var/log/apache2
# rm -f /etc/logrotate.d/apache.rpmsave
などとしておいて乗せ替えておくと良いよね♪