2009年10月 9日
apahce 2.2.14 が出たので入れてみた。
ひさしぶりにインストールして、apache, php, のバージョンアップをした。
まあセキュリティがーとかで一応バージョンアップ。
OS入れ替えたいなー。
投稿者 hideki : 02:24 | コメント (0) | トラックバック
2008年3月 1日
mod_dosdetector でDoS対策
あまり DoS はないのですが一応インストールしてみました。
Apache2.2用らしいです。はてなで実装してるとか。
ソース
http://sourceforge.net/projects/moddosdetector/
Makefile の修正
APXS=/usr/sbin/apxs を自分のインストールしてる場所に修正
make;make install でおわり。
httpd.conf に以下を追加
LoadModule dosdetector_module modules/mod_dosdetector.so
<IfModule mod_dosdetector.c>
DoSDetection on
DoSThreshold 5
DoSHardThreshold 10
DoSPeriod 60
DoSBanPeriod 60
DoSShmemName dosshm
DoSTableSize 100
</IfModule>
あとは実際に運用して様子見ぽいですね。rewrite ルールを使うことで、
別の鯖に飛ばすこともできるそうです。
投稿者 hideki : 18:14 | コメント (0) | トラックバック
2007年6月25日
apache2.2 から httpd.conf にincludeできなくなったのか...
新しいサイトを立ち上げるために準備していました。今までincludeでバーチャルホストしてたわけ
なのですが、問題も特におきていなかった。別のドメインを追加したところ、バーチャルホストが
動かない。うるおぼえでapache2.2でhttpd.confにincludeできなくなってたようだった。
とりあえず、新しい鯖に切り替えもメールサーバの一部のみ対策を考えるぐらいか。
投稿者 hideki : 01:11 | コメント (0) | トラックバック
2006年8月30日
apache の SendBufferSize を調整する
apache でレスポンスを良くするために、いろいろと調べています。
SendBufferSize という項目があり、この設定をすることにより、応答性が良くなる場合があるそうです。
実際レスポンスは良くなった気がします。(気がしますではダメなんですけどね。)
Webサーバの高速化としては、1.TCPコネクション集約、2.コンテンツ圧縮(gzip,deflate)、3.キャッシングがあり、apache で設定出来るものは、2と3です。また、設定の調整と無駄なモジュールを読み込まないことによって数%は高速化できます。
Webサーバの高速化アプライアンス機器は1~3を全部できるようにしているようです。
関連リンク
http://netaro.ddo.jp/techinfo/Linux/httpd_conf/ApacheConfig.html
http://httpd.apache.org/docs/2.2/ja/mod/mpm_common.html
投稿者 hideki : 00:34 | コメント (0) | トラックバック
2006年8月26日
mod_deflate の設定変更( ・ω・)∩
http://www.websiteoptimization.com/services/analyze/で自分のWebページのパフォーマンスを見ていて、*.jsファイルを使ってるものがあり、その*.jsファイルは設定が無かったため圧縮されて送られていなかったことに気づく。
で修正しました。
圧縮かけられるものはかけた方が、パケットが節約になる。
# コンテンツの圧縮
LoadModule deflate_module modules/mod_deflate.so
SetEnv gzip_only_text/html 1
SetOutputFilter DEFLATE
DeflateFilterNote deflate_compression_ratio
DeflateBufferSize 8096
DeflateMemLevel 9
DeflateWindowSize 15
<Directory />
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/xhtml+xml
</Directory>
○さっそくベンチマークで確認。
apache2.2+ mod_mem_cache
[root@oscar2 root]# /usr/local/apache2/bin/ab -n 100 -c 10 http://zephel.com/index.html
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking zephel.com (be patient).....done
Server Software: Apache/2.2.3
Server Hostname: zephel.com
Server Port: 80
Document Path: /index.html
Document Length: 28456 bytes
Concurrency Level: 10
Time taken for tests: 0.67489 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 2878100 bytes
HTML transferred: 2845600 bytes
Requests per second: 1481.72 [#/sec] (mean)
Time per request: 6.749 [ms] (mean)
Time per request: 0.675 [ms] (mean, across all concurrent requests)
Transfer rate: 41636.42 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.1 1 4
Processing: 1 5 2.6 5 14
Waiting: 0 3 2.5 3 12
Total: 1 5 2.8 6 16
Percentage of the requests served within a certain time (ms)
50% 6
66% 7
75% 7
80% 8
90% 9
95% 11
98% 14
99% 16
100% 16 (longest request)
と速くなったようだ。もう少し見直してみるかな。deflate を使いすぎてもサーバの CPU に負荷が
かかるらしいので、適当な状態でやめると良いでしょう。Core 2 Duo とか新しい Xeon とかなら
もっと負荷かけて良さそうだが。
投稿者 hideki : 09:37 | コメント (0) | トラックバック
2006年7月30日
Apache 2.2.3が出てた┐(´д`)┌
Apache 2.2.2を再コンパイルしてたときに、http://slashdot.jpを見ていたら Apache 2.2.3 が出ていることに気づく。やれやれと思いながらまた再コンパイル。
明示的に、disable しないと追加されてしまうものもあるようで困ったものです。
ダウンロードはこちらから
http://httpd.apache.org/download.cgi
投稿者 hideki : 17:23 | コメント (0) | トラックバック
2006年7月25日
apache2.2.2 またコンパイルし直し┐(´д`)┌
他のHDDにapacheをインストールすることにした。
disableを増やす┐(´д`)┌
CFLAGS="-O2 -fno-inline-functions -march=pentium4 -mmmx -msse -msse2" \
./configure \
--prefix=/usr/local/apache2.2 \
--with-mpm=worker \
--enable-threads \
--enable-so \
--enable-deflate=shared \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-rewrite \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-http \
--enable-proxy-balance \
--disable-autoindex \
--disable-asis \
--disable-auth_anon \
--disable-auth_dbm \
--disable-auth_digest \
--disable-auth_ldap \
--disable-cern_meta \
--disable-dav \
--disable-dav-fs \
--disable-echo \
--disable-example \
--disable-expires \
--disable-ext_filter \
--disable-negotiation \
--disable-info \
--disable-include \
--disable-imap \
--disable-ipv6 \
--disable-status \
--disable-speling \
--disable-ssl \
--disable-suexec \
--disable-status
投稿者 hideki : 01:08 | コメント (0) | トラックバック
2006年7月18日
apache2.2.2の再インストール( ・ω・)∩
apache2.2 の高速化をしようとチューニングをしていて、再コンパイルした。
いつものごとく、再インストール。
MT3.3 になって cgi がやたらと重くて使い物にならないんだけど、Google で検索するとlighttpd + FastCGI あたりに逃げているようだが、mod_mem_cache があるので、Apache はすてるわけにも行かず困ってます。mod_perlだとapache1.3系ではうまくうごくようですが、apache2.2ではまだうまく動かない。apache2 系の人は FastCGI を使ってる場合もあるみたいですね。システムのバージョンアップではなく、アプリで解決したいよなぁ。
http://httpd.apache.org/download.cgi 2.2.2はここからダウンロード
cd /usr/local/src
tar xvzf httpd-2.2.2.tar.bz2
CFLAGS="-O2 -fno-inline-functions -march=pentium4 -mmmx -msse -msse2"
./configure --prefix=/usr/local/apache2.2 \
--with-mpm=worker \
--enable-threads \
--enable-so \
--enable-deflate=shared \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--disable-info \
--disable-status \
--disable-include \
--disable-imap \
--disable-ipv6 \
--disable-asis \
--disable-auth_anon \
--disable-dav \
--disable-dav-fs \
--disable-status
make
make install
httpd.conf で見直したところ。
Timeout 30
KeepAlive On
# mod_mem_cacheの設定
< IfModule mod_cache.c >
< IfModule mod_mem_cache.c >
CacheEnable mem /
MCacheSize 256000
MCacheMinObjectSize 1
MCacheMaxObjectSize 128000
MCacheMaxStreamingBuffer 128000
< /IfModule >
< /IfModule >
# コンテンツの圧縮
LoadModule deflate_module modules/mod_deflate.so
SetEnv gzip_only_text/html 1
SetOutputFilter DEFLATE
DeflateFilterNote deflate_compression_ratio
DeflateBufferSize 8096
DeflateMemLevel 9
DeflateWindowSize 15
< Directory / >
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml
< /Directory >
#インデックスの自動作成の停止
#IndexOptions FancyIndexing VersionSort
ぐらいかなぁ。
投稿者 hideki : 00:40 | コメント (0) | トラックバック
2006年6月27日
Apache2.2 で mod_mem_cacheを使ってみる( ・ω・)∩
Apache2.2 から mod_mem_cache というのがあって、昔の逆proxyなのだが、結構速くなるとかで試してみた。メモリも3.5GBとか積んでるマシンなので、256MBをキャッシュに割り当ててみました┐(´д`)┌
CPUをPentium4 3.2GHzに切り替えるよ...ケースもそのうち交換するぞ(゚Д゚ )
apache でコンパイル時に、取り込んでます。
コンパイル時のオプション
./configure \
--prefix=/usr/local/apache2.2 \
--with-mpm=worker \
--enable-so \
--enable-shared \
--enable-deflate=shared \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--disable-info \
--disable-status \
--disable-include \
--disable-rewrite \
--disable-imap \
--disable-ipv6
1回キャッシュするとかなり速いですね。
lighttpd+FastCGIも考えているが、結局のところ、外から繋いでどれだけ速いかだし。ルータも交換するぞ( ・ω・)∩
とりあえず設定です。httpd.confに追加。
< IfModule mod_cache.c >
< IfModule mod_mem_cache.c >
CacheEnable mem /
## CacheDisable /home/hoge ←キャッシュしたくないのはこれで追加。
MCacheSize 256000
## MCacheMaxObjectCount 3000 キャッシュの数の指定だけど今回は無し。
MCacheMinObjectSize 1
MCacheMaxObjectSize 128000
MCacheMaxStreamingBuffer 128000
< /IfModule >
< /IfModule >
abでベンチします。
☆mod_mem_cache 無し
[root@oscar2 conf]# /usr/local/apache2/bin/ab -n 100 -c 10 http://zephel.com/index.html
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/
Benchmarking zephel.com (be patient).....done
Server Software: Apache/2.2.2
Server Hostname: zephel.com
Server Port: 80
Document Path: /index.html
Document Length: 23144 bytes
Concurrency Level: 10
Time taken for tests: 1.146204 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 2347500 bytes
HTML transferred: 2314400 bytes
Requests per second: 87.24 [#/sec] (mean)
Time per request: 114.620 [ms] (mean)
Time per request: 11.462 [ms] (mean, across all concurrent requests)
Transfer rate: 1999.64 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 12.4 1 104
Processing: 2 104 132.7 16 464
Waiting: 0 100 133.5 7 462
Total: 2 106 132.3 16 464
Percentage of the requests served within a certain time (ms)
50% 16
66% 143
75% 218
80% 308
90% 322
95% 339
98% 363
99% 464
100% 464 (longest request)
☆mod_mem_cache有り
[root@oscar2 conf]# /usr/local/apache2/bin/ab -n 100 -c 10 http://zephel.com/index.html
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/
Benchmarking zephel.com (be patient).....done
Server Software: Apache/2.2.2
Server Hostname: zephel.com
Server Port: 80
Document Path: /index.html
Document Length: 23144 bytes
Concurrency Level: 10
Time taken for tests: 0.66763 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 2420603 bytes
HTML transferred: 2383832 bytes
Requests per second: 1497.84 [#/sec] (mean)
Time per request: 6.676 [ms] (mean)
Time per request: 0.668 [ms] (mean, across all concurrent requests)
Transfer rate: 35393.86 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.9 0 3
Processing: 1 5 2.1 5 11
Waiting: 0 2 1.7 2 8
Total: 1 5 2.2 5 11
Percentage of the requests served within a certain time (ms)
50% 5
66% 6
75% 7
80% 7
90% 9
95% 9
98% 11
99% 11
100% 11 (longest request)
設定の参考
http://httpd.apache.org/docs/2.2/ja/mod/mod_mem_cache.html
投稿者 hideki : 00:13 | コメント (0) | トラックバック
2006年5月 3日
apache2.2.2+php-4.4.2 を入れる( ・ω・)∩
httpd2.2.2が出たので入れてみた。php-4.4.2をセットで入れた。
とりあえずインストール手順。
http://httpd.apache.org/download.cgi 2.2.2はここからダウンロード
cd /usr/local/src
tar xvzf httpd-2.2.2.tar.bz2
./configure \
--prefix=/usr/local/apache2.2 \
--with-mpm=worker \
--enable-so --enable-shared \
--enable-rewrite \
--enable-deflate=shared \
--disable-include
make
make install
http://jp2.php.net/downloads.php4.4.2 はここからダウンロード
tar xvzf php-4.4.2.tar.bz2
./configure \
--with-apxs2=/usr/local/apache2.2/bin/apxs \
--prefix=/usr/local/php \
--enable-mbstring \
--enable-mbstr-enc-trans \
--enable-mbregex \
--enable-trans-sid \
--with-zlib-dir=/usr/local/lib \
--with-gd \
--with-jpeg-dir=/usr/local/lib \
--with-png-dir=/usr/local/lib \
--with-freetype-dir=/usr/local/lib
make
make install
http://perl.apache.org/download/index.html はここからダウンロード
perl Makefile.PL DO_HTTPD=1 USER_APACI=1 EVERYTHING=1 MP_APXS=/usr/local/apache2.2/bin/apxs
make
make install
投稿者 hideki : 15:36 | コメント (0) | トラックバック
2005年12月 4日
httpd2.2.0をインストール
httpd2.2.0がリリースされたのでさっそく入れてみた。でも新しい機能はまだ使っていません。
Apache2.2 php-4.4.0
env OPTIM="-O2 -p4"で Pentium4に最適化してます。
http://httpd.apache.org/Apache 2.2.0はここからダウンロード
cd /usr/local/src
tar xvzf httpd-2.2.0.tar.bz2
env OPTIM="-O2 -p4" ./configure \
--prefix=/usr/local/apache2.2 \
--with-mpm=worker \
--enable-so --enable-shared \
--enable-rewrite \
--enable-deflate=shared \
--disable-include
make
make install
http://www.php.net/downloads.phpphp 4.4.0 はここからダウンロード
tar xvzf php-4.4.0.tar.bz2
env OPTIM="-O2 -p4" ./configure \
--with-apxs2=/usr/local/apache2.2/bin/apxs \
--prefix=/usr/local/php \
--enable-mbstring \
--enable-mbstr-enc-trans \
--enable-mbregex \
--enable-trans-sid \
--with-zlib-dir=/usr/local/lib \
--with-gd \
--with-jpeg-dir=/usr/local/lib \
--with-png-dir=/usr/local/lib \
--with-freetype-dir=/usr/local/lib
make
make install
http://perl.apache.org/download/index.htmlmod_perl2.0 はここからダウンロード
perl Makefile.PL DO_HTTPD=1 USER_APACI=1 EVERYTHING=1 MP_APXS=/usr/local/apache2.2/bin/apxs