決定為自己的apache減肥。ok現(xiàn)在就開(kāi)始吧 系統(tǒng)平臺(tái):redhat7.3 軟件版本:apache_1.3.28.tar.gz 安裝的模塊:core,access,alias,auth,dir,log_config,mime 說(shuō)明 core模塊就不用多說(shuō)。一定是要的,不要也不行 1、虛擬目錄的實(shí)現(xiàn)Alias mod_alias [Alias,ScriptAl
決定為自己的apache減肥。ok現(xiàn)在就開(kāi)始吧系統(tǒng)平臺(tái):redhat7.3
軟件版本:apache_1.3.28.tar.gz
安裝的模塊:core,access,alias,auth,dir,log_config,mime
說(shuō)明
core模塊就不用多說(shuō)。一定是要的,不要也不行
1、虛擬目錄的實(shí)現(xiàn)Alias mod_alias [Alias,ScriptAlias]
2、基于客戶端hostname,ip的訪問(wèn)控制 mod_access [Allow,Deny,Order]
3、基本的用戶認(rèn)證 mod_auth [AuthUserFile,AuthGroupFile]
4、自定義的訪問(wèn)日志 mod_log_config [LogFormat,CustomLog]
5、默認(rèn)的主頁(yè) mod_dir [DirectoryIndex]
6、可以定義的character set, content- encoding, handler, content-language和MIME mod_mime
apache的安裝。決定要安裝的模塊實(shí)際的安裝過(guò)程是簡(jiǎn)單的
./configure --prefix=/www/apache --disable-module=all
--enable-module=alias
--enable-module=access --enable-module=auth
--enable-module=log_config
--enable-module=dir --enable-module=mime
make
make install
查看安裝的模塊/www/apache/bin/httpd -l
Compiled-in modules:
http_core.c
mod_log_config.c
mod_mime.c
mod_dir.c
mod_alias.c
mod_access.c
mod_auth.c
最后讓我們看看安裝了這些模塊具體到配置文件中是怎樣使用的
配置文件舉例
# =================================================
# Basic settings
# =================================================
ServerType standalone
ServerRoot "/usr/local/apache"
PidFile /usr/local/apache/logs/httpd.pid
ScoreBoardFile /usr/local/apache/logs/httpd.scoreboard
ResourceConfig /dev/null
AccessConfig /dev/null
# =================================================
# Performance settings
# =================================================
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 150
MaxRequestsPerChild 0
# =================================================
# Apache's modules
# =================================================
ClearModuleList
AddModule mod_log_config.c
AddModule mod_mime.c
AddModule mod_dir.c
AddModule mod_access.c
AddModule mod_auth.c
AddModule mod_alias.c
# =================================================
# General settings
# =================================================
Port 80
User apache
Group apache
ServerAdmin Webmaster@www.abc.com
UseCanonicalName Off
ServerSignature Off
HostnameLookups Off
ServerTokens Prod
#—————————————— ###mod_dir模塊 #---------------------------------- DirectoryIndex index.html
DocumentRoot "/www/vhosts"
# =================================================
# Access control
#
#mod_access 模塊
=================================================
Options None
AllowOverride None
Order deny,allow
Deny from all
Order allow,deny Allow from all
Order allow,deny Allow from all
#==========================================
#basic auth
#
#mod-auth模塊
#=========================================
AuthType Basic AuthName "基本的用戶認(rèn)證" AuthUserFile /www/apache/passwd/passwords Require user zhangshan lisi
# =================================================
# MIME encoding
#
#mod_mime模塊
=================================================
TypesConfig /usr/local/apache/conf/mime.types
DefaultType text/plain
AddEncoding x-compress Z AddEncoding x-gzip gz tgz AddType application/x-tar .tgz
# =================================================
# Logs
#
#log_config模塊
=================================================
LogLevel warn
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
ErrorLog /usr/local/apache/logs/error_log
CustomLog /usr/local/apache/logs/access_log combined
# =================================================
# Virtual hosts
# =================================================
NameVirtualHost *
DocumentRoot "/www/vhosts/www.abc.com" ServerName "www.abc.com" ErrorLog logs/www.abc.com/error_log CustomLog logs/www.abc.com/access_log combined #===================================================== #虛擬目錄 # #mod-alias模塊 #===================================================== Alias /icons/ /www/vhosts/icons/
DocumentRoot "/www/vhosts/www.chinaunix.com" ServerName "www.chinaunix.com" ErrorLog logs/www.chinaunix.com/error_log CustomLog logs/www.chinaunix.com/access_log combined
配置文件中都標(biāo)出了每個(gè)模塊的使用方法。這里就不多說(shuō)。希望喜歡“苗條”的同志趕快行動(dòng)起來(lái)吧。最后不要忘了把你的瘦身方案拿出來(lái)大家分享
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com