http:
//httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
#youwillsaveyourselfalotoftrouble.
#
#DoNOTaddaslashattheendofthedirectorypath.
ServerRoot"/etc/httpd"//设置服务器的根目录
#
#PidFile:
Thefileinwhichtheservershouldrecorditsprocess
#identificationnumberwhenitstarts.
#
PidFilerun/httpd.pid//设置运行Apache时使用的PidFile的路径
#
#Timeout:
Thenumberofsecondsbeforereceivesandsendstimeout.
#
Timeout120//若120秒后没有收到或送出任何数据就切断该连接
#
#KeepAlive:
Whetherornottoallowpersistentconnections(morethan
#onerequestperconnection).Setto"Off"todeactivate.
#
KeepAliveOff//不使用保持连接的功能,即客户一次请求连接只能响应一个文件
/建议用户将此参数的值设置为On,即允许使用保持连接的功能
#
#MaxKeepAliveRequests:
Themaximumnumberofrequeststoallow
#duringapersistentconnection.Setto0toallowanunlimitedamount.
#Werecommendyouleavethisnumberhigh,formaximumperformance.
#
MaxKeepAliveRequests100//在使用保持连接功能时,设置客户一次请求连接能响应文件的最大上限
#
#KeepAliveTimeout:
Numberofsecondstowaitforthenextrequestfromthe
#sameclientonthesameconnection.
#
KeepAliveTimeout15//在使用保持连接功能时,两个相邻的连接的时间间隔超过15秒,就切断连接
###Server-PoolSizeRegulation(MPMspecific)
##
#preforkMPM
#StartServers:
numberofserverprocessestostart
#MinSpareServers:
minimumnumberofserverprocesseswhicharekeptspare
#MaxSpareServers:
maximumnumberofserverprocesseswhicharekeptspare
#ServerLimit:
maximumvalueforMaxClientsforthelifetimeoftheserver
#MaxClients:
maximumnumberofserverprocessesallowedtostart
#MaxRequestsPerChild:
maximumnumberofrequestsaserverprocessserves
//设置使用Prefork MPM运行方式的参数,此运行方式是Red hat默认的方式
StartServers8//设置服务器启动时运行的进程数
MinSpareServers5//Apache在运行时会根据负载的轻重自动调整空闲子进程的数目
//若存在低于5个空闲子进程,就创建一个新的子进程准备为客户提供服务
MaxSpareServers20//若存在高于20个空闲子进程,就创建逐一删除子进程来提高系统性能
ServerLimit256
MaxClients256//限制同一时间的连接数不能超过256
MaxRequestsPerChild4000//限制每个子进程在结束处理请求之前能处理的连接请求为4000
#workerMPM
#StartServers:
initialnumberofserverprocessestostart
#MaxClients:
maximumnumberofsimultaneousclientconnections
#MinSpareThreads:
minimumnumberofworkerthreadswhicharekeptspare
#MaxSpareThreads:
maximumnumberofworkerthreadswhicharekeptspare
#ThreadsPerChild:
constantnumberofworkerthreadsineachserverprocess
#MaxRequestsPerChild:
maximumnumberofrequestsaserverprocessserves
//设置使用perchild MPM运行方式的参数
StartServers2
MaxClients150
MinSpareThreads25
MaxSpareThreads75
ThreadsPerChild25
MaxRequestsPerChild0
#
#Listen:
AllowsyoutobindApachetospecificIPaddressesand/or
#ports,inadditiontothedefault.Seealsothe
#directive.
#ChangethistoListenonspecificIPaddressesasshownbelowto
#preventApachefromglommingontoallboundIPaddresses(0.0.0.0)
#
#Listen12.34.56.78:
80
Listen90//设置服务器的监听端口
#
#DynamicSharedObject(DSO)Support//动态加载模块(DSO)
#
#TobeabletousethefunctionalityofamodulewhichwasbuiltasaDSOyou
#havetoplacecorresponding`LoadModule'linesatthislocationsothe
#directivescontainedinitareactuallyavailable_before_theyareused.
#Staticallycompiledmodules(thoselistedby`httpd-l')donotneed
#tobeloadedhere.
#Example:
#LoadModulefoo_modulemodules/mod_foo.so
#
LoadModuleauth_basic_modulemodules/mod_auth_basic.so
LoadModuleauth_digest_modulemodules/mod_auth_digest.so
LoadModuleauthn_file_modulemodules/mod_authn_file.so
LoadModuleauthn_alias_modulemodules/mod_authn_alias.so
LoadModuleauthn_anon_modulemodules/mod_authn_anon.so
LoadModuleauthn_dbm_modulemodules/mod_authn_dbm.so
LoadModuleauthn_default_modulemodules/mod_authn_default.so
LoadModuleauthz_host_modulemodules/mod_authz_host.so
LoadModuleauthz_user_modulemodules/mod_authz_user.so
LoadModuleauthz_owner_modulemodules/mod_authz_owner.so
LoadModuleauthz_groupfile_modulemodules/mod_authz_groupfile.so
LoadModuleauthz_dbm_modulemodules/mod_authz_dbm.so
LoadModuleauthz_default_modulemodules/mod_authz_default.so
LoadModuleldap_modulemodules/mod_ldap.so
LoadModuleauthnz_ldap_modulemodules/mod_authnz_ldap.so
LoadModuleinclude_modulemodules/mod_include.so
LoadModulelog_config_modulemodules/mod_log_config.so
LoadModulelogio_modulemodules/mod_logio.so
LoadModuleenv_modulemodules/mod_env.so
LoadModuleext_filter_modulemodules/mod_ext_filter.so
LoadModulemime_magic_modulemodules/mod_mime_magic.so
LoadModuleexpires_modulemodules/mod_expires.so
LoadModuledeflate_modulemodules/mod_deflate.so
LoadModuleheaders_modulemodules/mod_headers.so
LoadModuleusertrack_modulemodules/mod_usertrack.so
LoadModulesetenvif_modulemodules/mod_setenvif.so
LoadModulemime_modulemodules/mod_mime.so
LoadModuledav_modulemodules/mod_dav.so
LoadModulestatus_modulemodules/mod_status.so
LoadModuleautoindex_modulemodules/mod_autoindex.so
LoadModuleinfo_modulemodules/mod_info.so
LoadModuledav_fs_modulemodules/mod_dav_fs.so
LoadModulevhost_alias_modulemodules/mod_vhost_alias.so
LoadModulenegotiation_modulemodules/mod_negotiation.so
LoadModuledir_modulemodules/mod_dir.so
LoadModuleactions_modulemodules/mod_actions.so
LoadModulespeling_modulemodules/mod_speling.so
LoadModuleuserdir_modulemodules/mod_userdir.so
LoadModulealias_modulemodules/mod_alias.so
LoadModulerewrite_modulemodules/mod_rewrite.so
LoadModuleproxy_modulemodules/mod_proxy.so
LoadModuleproxy_balancer_modulemodules/mod_proxy_balancer.so
LoadModuleproxy_ftp_modulemodules/mod_proxy_ftp.so
LoadModuleproxy_http_modulemodules/mod_proxy_http.so
LoadModuleproxy_connect_modulemodules/mod_proxy_connect.so
LoadModulecache_modulemodules/mod_cache.so
LoadModulesuexec_modulemodules/mod_suexec.so
LoadModuledisk_cache_modulemodules/mod_disk_cache.so
LoadModulefile_cache_modulemodules/mod_file_cache.so
LoadModulemem_cache_modulemodules/mod_mem_cache.so
LoadModulecgi_modulemodules/mod_cgi.so
LoadModuleversion_modulemodules/mod_version.so
#
#Thefollowingmodulesarenotloadedbydefault:
#LoadModulecern_meta_modulemodules/mod_cern_meta.so
#LoadModuleasis_modulemodules/mod_asis.so
#
#Loadconfigfilesfromtheconfigdirectory"/etc/httpd/conf.d".
//将/etc/httpd/conf.d目录下所有以conf结尾的配置文件包含进来
Includeconf.d/*.conf
#
#ExtendedStatuscontrolswhetherApachewillgenerate"full"status
#information(ExtendedStatusOn)orjustbasicinformation(ExtendedStatus
#Off)whenthe"server-status"handleriscalled.ThedefaultisOff.
#
#ExtendedStatusOn
#
#Ifyouwishhttpdtorunasadifferentuserorgroup,youmustrun
#httpdasrootinitiallyanditwillswitch.
#
#User/Group:
Thename(or#number)oftheuser/grouptorunhttpdas.
#.OnSCO(ODT3)use"Usernouser"and"Groupnogroup".
#.OnHPUXyoumaynotbeabletousesharedmemoryasnobody,andthe
#suggestedworkaroundistocreateauserwwwandusethatuser.
#NOTEthatsomekernelsrefusetosetgid(Group)orsemctl(IPC_SET)
#whenthevalueof(unsigned)Groupisabove60000;
#don'tuseGroup#-1onthesesystems!
//设置运行Apache服务器的用户和组
Userapache
Groupapache
###Section2:
'Main'serverconfiguration
#Thedirectivesinthi