apache2.2支援worker,rewrite模組,支援執行緒

wangzhensheng發表於2007-06-04

apache編譯安裝
//httpd2.2
./configure --prefix=/home/www --enable-rewrite --enable-so --with-mpm=worker --with-threads=yes

[@more@]

apache編譯安裝
//httpd2.2
./configure --prefix=/home/www --enable-rewrite --enable-so --with-mpm=worker --with-threads=yes

//lt_LogFormat
LogFormat "%h %l %u %{[%Y/%m/%d/%w:%H:%M:%S]}t "%r" %>s %b "%{User-agent}i"" combined
CustomLog "|/usr/local/sbin/cronolog /home/www20/logs/web-%Y%m%d.log" combined


//fj_LogFormat
LogFormat "%h %l %u %{,%a%Y/%m/%d:%H:%M:%S}t "%r" %>s %b "%{User-Agent}i"" common
CustomLog "|/usr/local/sbin/cronolog /home/www20/logs/web-%Y%m%d.log" common


Options -Indexes FollowSymLinks
AllowOverride None
AuthType Basic
AuthName renzhen   
AuthUserFile /usr/local/apache/conf/pass
require valid-user + 使用者   

cd /usr/local/apache/bin
./htpasswd -c /usr/local/apache/conf/pass +使用者名稱
chown apache.apache /usr/local/apache/conf/pass

//http TRACE 跨站攻擊
下面介紹一下怎樣開啟apache的mod_rewrite功能。
#tar -zxvf httpd-2.0.59.tar.gz
#cd httpd-2.0.59
#./configure -prefix=/opt/apache2 -enable-modules=so -enable-module=rewrite -enable-shared=rewrite -

enable-shared=max
#make
#make install
# httpd -l //看到有worker.c說明已經支援worker模組


apache安裝完畢,下面來載入編譯mod_rewrite.so這個模組。
#cd /soft/httpd-2.0.59/modules/mappers
#/opt/apache2/bin/apxs -c mod_rewrite.c -lgdbm
#gcc -shared -o mod_rewrite.so mod_rewrite.o -lgdbm
#/opt/apache2/bin/apxs -i -A -n rewrite mod_rewrite.so

是Apache, 在各虛擬主機的配置檔案裡新增如下語句:
LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]

//httpd2.2
修改$APACHE_HOME/conf/httpd.conf
#Include conf/extra/httpd-mpm.conf
取消前面註釋

編輯conf/extra/httpd-mpm.conf
找到# worker MPM
MaxClients 150

在其前面新增
ServerLimit 16

============================================

編譯多個apache

make clean; ./configure --prefix=/app/apache/apache_hd --enable-rewrite --enable-so --with-mpm=worker --with-threads=yes --enable-headers --enable-deflate ;make ;make install
make clean; ./configure --prefix=/app/apache/apache_hnd --enable- --enable-so --with-mpm=worker --with-threads=yes ;make ;make install
make clean; ./configure --prefix=/app/apache/apache_pd --enable-rewrrewriteite --enable-so --enable-headers --enable-deflate ;make ;make install
make clean; ./configure --prefix=/app/apache/apache_pnd --enable-rewrite --enable-so ;make ;make install
make clean; ./configure --prefix=/app/apache/apache_cache --enable-rewrite --enable-so --with-mpm=worker --with-threads=yes --enable-headers --enable-deflate --enable-cache --enable-disk-cache --enable-mem-cache;make ;make install

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8806316/viewspace-917317/,如需轉載,請註明出處,否則將追究法律責任。

相關文章