Linux下Web服務(wù)器架設(shè)筆錄教學(xué)內(nèi)容_第1頁
Linux下Web服務(wù)器架設(shè)筆錄教學(xué)內(nèi)容_第2頁
Linux下Web服務(wù)器架設(shè)筆錄教學(xué)內(nèi)容_第3頁
Linux下Web服務(wù)器架設(shè)筆錄教學(xué)內(nèi)容_第4頁
Linux下Web服務(wù)器架設(shè)筆錄教學(xué)內(nèi)容_第5頁
已閱讀5頁,還剩128頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、Good is good, but better carries it.精益求精,善益求善。Linux下Web服務(wù)器架設(shè)筆錄Linux下Web服務(wù)器架設(shè)筆錄本文環(huán)境:CentOS5.4+ApacheApache的安裝CentOS默認(rèn)已安裝Apache服務(wù)器軟件,可使用rpm命令檢查安裝情況:dxlocalhost$rpm-qa|grephttpdhttpd-2.2.3-31.el5.centos若沒有默認(rèn)安裝,可在安裝光盤內(nèi)找到rpm包并進(jìn)行安裝:dxlocalhost$rpmivhhttpd-2.2.3-31.e15.i386.rpm安裝成功后,幾個重要的文件分布如下:/etc/httpd/

2、conf/httpd.confApache的主配置文件/etc/httpd/logsApache的日志存放目錄/etc/httpd/modulesApache的模塊存放目錄/usr/lib/httpd/modulesApache模塊存放的另一目錄/usr/sbin/apachectlApache控制腳本(非目錄),用于啟動、停止等操作Httpd進(jìn)程運(yùn)行時需要apache用戶的支持,CentOS在安裝時一般情況下已默認(rèn)創(chuàng)建了這個用戶,如果系統(tǒng)中沒有這個用戶,應(yīng)該重新創(chuàng)建。運(yùn)行ApacheApache安裝完成之后,有一套默認(rèn)的配置文件可以啟動:rootlocalhostdx#/usr/sbin/a

3、pachectlstart查看進(jìn)程的啟動狀態(tài):rootlocalhostdx#ps-eaf|grephttpdroot111961014:54?00:00:00/usr/sbin/httpd-kstartapache1119711196014:54?00:00:00/usr/sbin/httpd-kstartapache1119811196014:54?00:00:00/usr/sbin/httpd-kstartapache1119911196014:54?00:00:00/usr/sbin/httpd-kstartapache1120011196014:54?00:00:00/usr/sbi

4、n/httpd-kstartapache1120111196014:54?00:00:00/usr/sbin/httpd-kstartapache1120211196014:54?00:00:00/usr/sbin/httpd-kstartapache1120311196014:54?00:00:00/usr/sbin/httpd-kstartapache1120411196014:54?00:00:00/usr/sbin/httpd-kstart可以看到,有9個Apache的進(jìn)程,其中一個是由root用戶身份運(yùn)行,另外8個以apache用戶身份運(yùn)行,這8個進(jìn)程是第1個進(jìn)程的子進(jìn)程。啟動多個進(jìn)

5、程的目的是為了更好地為客戶端提供服務(wù),初始子進(jìn)程的個數(shù)可以在配置文件中指定。設(shè)置Apache隨系統(tǒng)啟動而啟動:rootlocalhostdx#chkconfig-listhttpdhttpd0:關(guān)閉1:關(guān)閉2:關(guān)閉3:關(guān)閉4:關(guān)閉5:關(guān)閉6:關(guān)閉rootlocalhostdx#chkconfighttpdonrootlocalhostdx#chkconfig-listhttpdhttpd0:關(guān)閉1:關(guān)閉2:啟用3:啟用4:啟用5:啟用6:關(guān)閉檢查端口監(jiān)聽狀態(tài):rootlocalhostdx#netstat-an|grep:80tcp00:80:*LISTEN確定端口狀態(tài)后,只要防火墻有設(shè)置ht

6、tp為信任的協(xié)議,就可以在客戶端訪問Apache的測試頁面了:HYPERLINK43/43/Apache服務(wù)器的全局配置Apache服務(wù)器的配置主要集中在主配置文件/etc/httpd/conf/httpd.conf中,本節(jié)先介紹Apache服務(wù)器的全局基本配置,之后再介紹目錄訪問控制,用戶個人網(wǎng)站配置,虛擬主機(jī)配置等其他高級配置。Apache的例子配置文件包含了很多的配置選項(xiàng),涵蓋了Apache服務(wù)器的大部分的重要功能,里面的配置指令包括全局配置、主服務(wù)器配置和虛擬主機(jī)配置三大部分,這里首先解釋一下例子配置文件中有關(guān)全局配置的指令,他們決定了Apache服務(wù)器的總體性能。rootlocalh

7、ostconf#more/etc/httpd/conf/httpd.conf#ThisisthemainApacheserverconfigurationfile.Itcontainsthe#configurationdirectivesthatgivetheserveritsinstructions.#Seefordetailedinformation.#Inparticular,see#foradiscussionofeachconfigurationdirective.#DoNOTsimplyreadtheinstructionsinherewithoutunderstanding#wh

8、attheydo.Theyrehereonlyashintsorreminders.Ifyouareunsure#consulttheonlinedocs.Youhavebeenwarned.#Theconfigurationdirectivesaregroupedintothreebasicsections:#1.DirectivesthatcontroltheoperationoftheApacheserverprocessasa#whole(theglobalenvironment).#2.Directivesthatdefinetheparametersofthemainordefau

9、ltserver,#whichrespondstorequeststhatarenthandledbyavirtualhost.#Thesedirectivesalsoprovidedefaultvaluesforthesettings#ofallvirtualhosts.#3.Settingsforvirtualhosts,whichallowWebrequeststobesentto#differentIPaddressesorhostnamesandhavethemhandledbythe#sameApacheserverprocess.#Configurationandlogfilen

10、ames:Ifthefilenamesyouspecifyformany#oftheserverscontrolfilesbeginwith/(ordrive:/forWin32),the#serverwillusethatexplicitpath.Ifthefilenamesdo*not*begin#with/,thevalueofServerRootisprepended-sologs/foo.log#withServerRootsetto/etc/httpdwillbeinterpretedbythe#serveras/etc/httpd/logs/foo.log.#Section1:G

11、lobalEnvironment#全局配置部分指令#ThedirectivesinthissectionaffecttheoveralloperationofApache,#suchasthenumberofconcurrentrequestsitcanhandleorwhereit#canfinditsconfigurationfiles.#Dontgiveawaytoomuchinformationaboutallthesubcomponents#wearerunning.Commentoutthislineifyoudontmindremotesites#findingoutwhatma

12、joroptionalmodulesyouarerunningServerTokensOS#連接時顯示Apache的版本和操作系統(tǒng)的名稱#ServerRoot:Thetopofthedirectorytreeunderwhichtheservers#configuration,error,andlogfilesarekept.#NOTE!IfyouintendtoplacethisonanNFS(orotherwisenetwork)#mountedfilesystemthenpleasereadtheLockFiledocumentation#(availableat);#youwillsa

13、veyourselfalotoftrouble.#DoNOTaddaslashattheendofthedirectorypath.#ServerRoot/etc/httpd#指定服務(wù)器的根目錄,以后在配置文件中指定起始符號不是”/”的路徑時,以該目錄作為起始目錄,如logs/error_log即表示/etc/httpd/logs/error_log#PidFile:Thefileinwhichtheservershouldrecorditsprocess#identificationnumberwhenitstarts.#PidFilerun/httpd.pid#Timeout:Thenum

14、berofsecondsbeforereceivesandsendstimeout.#Timeout120#客戶端建立連接后如果連續(xù)120秒內(nèi)沒有響應(yīng),則切斷連接#KeepAlive:Whetherornottoallowpersistentconnections(morethan#onerequestperconnection).SettoOfftodeactivate.#KeepAliveOff#“Off”表示不使用持久連接功能,即在一個TCP連接中只傳送一個請求和一個應(yīng)答消息。建議設(shè)置為on,可提高服務(wù)器性能。#MaxKeepAliveRequests:Themaximumnumbero

15、frequeststoallow#duringapersistentconnection.Setto0toallowanunlimitedamount.#Werecommendyouleavethisnumberhigh,formaximumperformance.#MaxKeepAliveRequests100#使用持久連接時,該連接允許發(fā)送的最大請求消息數(shù)。如果設(shè)為0,表示沒有限制。#KeepAliveTimeout:Numberofsecondstowaitforthenextrequestfromthe#sameclientonthesameconnection.#KeepAliveT

16、imeout15#使用持久連接功能時,客戶端的下一個請求消息超過15秒還未到達(dá),就切斷該連接。#Server-PoolSizeRegulation(MPMspecific)#設(shè)置使用preforkMPM運(yùn)行方式的參數(shù),CentOS中默認(rèn)以此方式運(yùn)行Apache服務(wù)器。#配置Apache運(yùn)行時啟動多少個進(jìn)程來處理客戶端的請求。#preforkMPM#StartServers:numberofserverprocessestostart#MinSpareServers:minimumnumberofserverprocesseswhicharekeptspare#MaxSpareServers:m

17、aximumnumberofserverprocesseswhicharekeptspare#ServerLimit:maximumvalueforMaxClientsforthelifetimeoftheserver#MaxClients:maximumnumberofserverprocessesallowedtostart#MaxRequestsPerChild:maximumnumberofrequestsaserverprocessserves#模塊定義開始StartServers8#初始的httpd子進(jìn)程數(shù)為8個MinSpareServers5#最小的空閑httpd子進(jìn)程總數(shù)為5個

18、MaxSpareServers20#最大的空閑httpd子進(jìn)程總數(shù)為20個ServerLimit256#最大的httpd子進(jìn)程數(shù)允許值為256個MaxClients256#最大客戶端連接數(shù)為256MaxRequestsPerChild4000#每個httpd子進(jìn)程處理了4000個請求后要關(guān)閉#模塊定義結(jié)束#設(shè)置workerMPM方式的參數(shù),與preforkMPM類似,但設(shè)置的是線程數(shù)。#workerMPM#StartServers:initialnumberofserverprocessestostart#MaxClients:maximumnumberofsimultaneousclient

19、connections#MinSpareThreads:minimumnumberofworkerthreadswhicharekeptspare#MaxSpareThreads:maximumnumberofworkerthreadswhicharekeptspare#ThreadsPerChild:constantnumberofworkerthreadsineachserverprocess#MaxRequestsPerChild:maximumnumberofrequestsaserverprocessserves#模塊定義開始StartServers2#主控制進(jìn)程生成2個httpd子

20、進(jìn)程MaxClients150#最大客戶端連接數(shù)為150MinSpareThreads25#最小的空閑httpd線程總數(shù)為25個MaxSpareThreads75#最大的空閑httpd線程總數(shù)為75個ThreadsPerChild25#每個子進(jìn)程可產(chǎn)生25個線程MaxRequestsPerChild0#每個子進(jìn)程處理的最大請求數(shù),0表示沒有限制#模塊定義結(jié)束#Listen:AllowsyoutobindApachetospecificIPaddressesand/or#ports,inadditiontothedefault.Seealsothe#directive.#Changethisto

21、ListenonspecificIPaddressesasshownbelowto#preventApachefromglommingontoallboundIPaddresses()#Listen8:80Listen80#設(shè)置服務(wù)器的監(jiān)聽端口為80#DynamicSharedObject(DSO)Support#TobeabletousethefunctionalityofamodulewhichwasbuiltasaDSOyou#havetoplacecorrespondingLoadModulelinesatthislocationsothe#directivescontainedini

22、tareactuallyavailable_before_theyareused.#Staticallycompiledmodules(thoselistedbyhttpd-l)donotneed#tobeloadedhere.#Example:#LoadModulefoo_modulemodules/mod_foo.so#加載動態(tài)模塊(DSO)LoadModuleauth_basic_modulemodules/mod_auth_basic.soLoadModuleauth_digest_modulemodules/mod_auth_digest.soLoadModuleauthn_file

23、_modulemodules/mod_authn_file.soLoadModuleauthn_alias_modulemodules/mod_authn_alias.soLoadModuleauthn_anon_modulemodules/mod_authn_anon.soLoadModuleauthn_dbm_modulemodules/mod_authn_dbm.soLoadModuleauthn_default_modulemodules/mod_authn_default.soLoadModuleauthz_host_modulemodules/mod_authz_host.soLo

24、adModuleauthz_user_modulemodules/mod_authz_user.soLoadModuleauthz_owner_modulemodules/mod_authz_owner.soLoadModuleauthz_groupfile_modulemodules/mod_authz_groupfile.soLoadModuleauthz_dbm_modulemodules/mod_authz_dbm.soLoadModuleauthz_default_modulemodules/mod_authz_default.soLoadModuleldap_modulemodul

25、es/mod_ldap.soLoadModuleauthnz_ldap_modulemodules/mod_authnz_ldap.soLoadModuleinclude_modulemodules/mod_include.soLoadModulelog_config_modulemodules/mod_log_config.soLoadModulelogio_modulemodules/mod_logio.soLoadModuleenv_modulemodules/mod_env.soLoadModuleext_filter_modulemodules/mod_ext_filter.soLo

26、adModulemime_magic_modulemodules/mod_mime_magic.soLoadModuleexpires_modulemodules/mod_expires.soLoadModuledeflate_modulemodules/mod_deflate.soLoadModuleheaders_modulemodules/mod_headers.soLoadModuleusertrack_modulemodules/mod_usertrack.soLoadModulesetenvif_modulemodules/mod_setenvif.soLoadModulemime

27、_modulemodules/mod_mime.soLoadModuledav_modulemodules/mod_dav.soLoadModulestatus_modulemodules/mod_status.soLoadModuleautoindex_modulemodules/mod_autoindex.soLoadModuleinfo_modulemodules/mod_info.soLoadModuledav_fs_modulemodules/mod_dav_fs.soLoadModulevhost_alias_modulemodules/mod_vhost_alias.soLoad

28、Modulenegotiation_modulemodules/mod_negotiation.soLoadModuledir_modulemodules/mod_dir.soLoadModuleactions_modulemodules/mod_actions.soLoadModulespeling_modulemodules/mod_speling.soLoadModuleuserdir_modulemodules/mod_userdir.soLoadModulealias_modulemodules/mod_alias.soLoadModulerewrite_modulemodules/

29、mod_rewrite.soLoadModuleproxy_modulemodules/mod_proxy.soLoadModuleproxy_balancer_modulemodules/mod_proxy_balancer.soLoadModuleproxy_ftp_modulemodules/mod_proxy_ftp.soLoadModuleproxy_http_modulemodules/mod_proxy_http.soLoadModuleproxy_connect_modulemodules/mod_proxy_connect.soLoadModulecache_modulemo

30、dules/mod_cache.soLoadModulesuexec_modulemodules/mod_suexec.soLoadModuledisk_cache_modulemodules/mod_disk_cache.soLoadModulefile_cache_modulemodules/mod_file_cache.soLoadModulemem_cache_modulemodules/mod_mem_cache.soLoadModulecgi_modulemodules/mod_cgi.soLoadModuleversion_modulemodules/mod_version.so

31、#Thefollowingmodulesarenotloadedbydefault:#LoadModulecern_meta_modulemodules/mod_cern_meta.so#LoadModuleasis_modulemodules/mod_asis.so#Loadconfigfilesfromtheconfigdirectory/etc/httpd/conf.d.#將conf.d/目錄下的所有后綴名為.conf的文件內(nèi)容包含進(jìn)來,根據(jù)以上ServerRoot的配置,這個目錄應(yīng)該是:/etc/httpd/conf.d/*.conf#這個目錄中包含了許多專用功能的配置,如JSP、PH

32、P、SSL等的配置文件Includeconf.d/*.conf#ExtendedStatuscontrolswhetherApachewillgeneratefullstatus#information(ExtendedStatusOn)orjustbasicinformation(ExtendedStatus#Off)whentheserver-statushandleriscalled.ThedefaultisOff.#ExtendedStatusOn#Ifyouwishhttpdtorunasadifferentuserorgroup,youmustrun#httpdasrootinit

33、iallyanditwillswitch.#User/Group:Thename(or#number)oftheuser/grouptorunhttpdas.#.OnSCO(ODT3)useUsernouserandGroupnogroup.#.OnHPUXyoumaynotbeabletousesharedmemoryasnobody,andthe#suggestedworkaroundistocreateauserwwwandusethatuser.#NOTEthatsomekernelsrefusetosetgid(Group)orsemctl(IPC_SET)#whenthevalue

34、of(unsigned)Groupisabove60000;#dontuseGroup#-1onthesesystems!#指定運(yùn)行httpd子進(jìn)程的用戶和用戶組身份UserapacheGroupapacheApache主服務(wù)器配置Apache處理客戶端的請求時,會根據(jù)URL來判斷客戶端是否需要訪問虛擬主機(jī)。如果不是訪問虛擬主機(jī),則認(rèn)為是訪問主服務(wù)器。主服務(wù)器的配置將作為后面虛擬主機(jī)的默認(rèn)配置,如果在虛擬主機(jī)中出現(xiàn)了同樣的指令,則會覆蓋對應(yīng)的指令。#Section2:Mainserverconfiguration#主服務(wù)器配置部分指令#Thedirectivesinthissectionset

35、upthevaluesusedbythemain#server,whichrespondstoanyrequeststhatarenthandledbya#definition.Thesevaluesalsoprovidedefaultsfor#anycontainersyoumaydefinelaterinthefile.#Allofthesedirectivesmayappearinsidecontainers,#inwhichcasethesedefaultsettingswillbeoverriddenforthe#virtualhostbeingdefined.#ServerAdmi

36、n:Youraddress,whereproblemswiththeservershouldbe#e-mailed.Thisaddressappearsonsomeserver-generatedpages,such#aserrordocuments.e.g.admin#ServerAdminrootlocalhost#管理員的E-Mail地址,會出現(xiàn)在一些出錯頁面中#ServerNamegivesthenameandportthattheserverusestoidentifyitself.#Thiscanoftenbedeterminedautomatically,butwerecomme

37、ndyouspecify#itexplicitlytopreventproblemsduringstartup.#IfthisisnotsettovalidDNSnameforyourhost,server-generated#redirectionswillnotwork.SeealsotheUseCanonicalNamedirective.#IfyourhostdoesnthavearegisteredDNSname,enteritsIPaddresshere.#Youwillhavetoaccessitbyitsaddressanyway,andthiswillmake#redirec

38、tionsworkinasensibleway.#ServerN:80#當(dāng)Apache服務(wù)器引用自己的URL時,使用這里指定的域名和端口號。#UseCanonicalName:DetermineshowApacheconstructsself-referencing#URLsandtheSERVER_NAMEandSERVER_PORTvariables.#WhensetOff,ApachewillusetheHostnameandPortsupplied#bytheclient.WhensetOn,Apachewillusethevalueofthe#ServerNamedirective.

39、#UseCanonicalNameOff#當(dāng)Apache構(gòu)建引用自己的URL時,使用這里指定的域名和端口號,如果此選項(xiàng)打開,則使用由ServerName指定的主機(jī)名和端口。#DocumentRoot:Thedirectoryoutofwhichyouwillserveyour#documents.Bydefault,allrequestsaretakenfromthisdirectory,but#symboliclinksandaliasesmaybeusedtopointtootherlocations.#DocumentRoot/var/www/html#主服務(wù)器的根文檔路徑。#Eachd

40、irectorytowhichApachehasaccesscanbeconfiguredwithrespect#towhichservicesandfeaturesareallowedand/ordisabledinthat#directory(anditssubdirectories).#First,weconfigurethedefaulttobeaveryrestrictivesetof#features.#設(shè)置根目錄的訪問控制權(quán)OptionsFollowSymLinksAllowOverrideNone#Notethatfromthispointforwardyoumustspeci

41、ficallyallow#particularfeaturestobeenabled-soifsomethingsnotworkingas#youmightexpect,makesurethatyouhavespecificallyenabledit#below.#ThisshouldbechangedtowhateveryousetDocumentRootto.#設(shè)置主服務(wù)器主目錄的訪問控制權(quán)#定義開始#PossiblevaluesfortheOptionsdirectiveareNone,All,#oranycombinationof:#IndexesIncludesFollowSymLi

42、nksSymLinksifOwnerMatchExecCGIMultiViews#NotethatMultiViewsmustbenamed*explicitly*OptionsAll#doesntgiveittoyou.#TheOptionsdirectiveisbothcomplicatedandimportant.Pleasesee#/docs/2.2/mod/core.html#options#formoreinformation.#OptionsIndexesFollowSymLinks#AllowOverridecontrolswhatdirectivesmaybeplacedin

43、.htaccessfiles.#ItcanbeAll,None,oranycombinationofthekeywords:#OptionsFileInfoAuthConfigLimit#AllowOverrideNone#Controlswhocangetstufffromthisserver.#Orderallow,denyAllowfromall#定義結(jié)束#UserDir:Thenameofthedirectorythatisappendedontoausershome#directoryifauserrequestisreceived.#Thepathtotheenduseraccou

44、ntpublic_htmldirectorymustbe#accessibletothewebserveruserid.Thisusuallymeansthatuserid#musthavepermissionsof711,userid/public_htmlmusthavepermissions#of755,anddocumentscontainedthereinmustbeworld-readable.#Otherwise,theclientwillonlyreceivea403Forbiddenmessage.#Seealso:/docs/misc/FAQ.html#forbidden#

45、用戶個人服務(wù)器#UserDirisdisabledbydefaultsinceitcanconfirmthepresence#ofausernameonthesystem(dependingonhomedirectory#permissions).#UserDirdisable#不允許用戶使用個人服務(wù)器#Toenablerequeststo/user/toservetheuserspublic_html#directory,removetheUserDirdisablelineabove,anduncomment#thefollowinglineinstead:#UserDirpublic_h

46、tml#ControlaccesstoUserDirdirectories.Thefollowingisanexample#forasitewherethesedirectoriesarerestrictedtoread-only.#用戶個人服務(wù)器的配置,默認(rèn)是禁用的#AllowOverrideFileInfoAuthConfigLimit#OptionsMultiViewsIndexesSymLinksIfOwnerMatchIncludesNoExec#Orderallow,deny#Allowfromall#Orderdeny,allow#Denyfromall#DirectoryInd

47、ex:setsthefilethatApachewillserveifadirectory#isrequested.#Theindex.html.varfile(atype-map)isusedtodelivercontent-#negotiateddocuments.TheMultiViewsOptioncanbeusedforthe#samepurpose,butitismuchslower.#指定主服務(wù)器的默認(rèn)主頁面的名稱,當(dāng)客戶端訪問服務(wù)器時,依次查找頁面index.html、index.html.varDirectoryIndexindex.htmlindex.html.var#Ac

48、cessFileName:Thenameofthefiletolookforineachdirectory#foradditionalconfigurationdirectives.SeealsotheAllowOverride#directive.#每個目錄都可以包含對本目錄的訪問權(quán)限進(jìn)行設(shè)置的文件,這里指定配置文件的名稱AccessFileName.htaccess#Thefollowinglinesprevent.htaccessand.htpasswdfilesfrombeing#viewedbyWebclients.#拒絕訪問以.ht開頭的文件,即保證.htaccess文件不被客戶端

49、訪問Orderallow,denyDenyfromall#TypesConfigdescribeswherethemime.typesfile(orequivalent)is#tobefound.#TypesConfig/etc/mime.types#DefaultTypeisthedefaultMIMEtypetheserverwilluseforadocument#ifitcannototherwisedetermineone,suchasfromfilenameextensions.#IfyourservercontainsmostlytextorHTMLdocuments,text/p

50、lainis#agoodvalue.Ifmostofyourcontentisbinary,suchasapplications#orimages,youmaywanttouseapplication/octet-streaminsteadto#keepbrowsersfromtryingtodisplaybinaryfilesasthoughtheyare#text.#DefaultTypetext/plain#Themod_mime_magicmoduleallowstheservertousevarioushintsfromthe#contentsofthefileitselftodet

51、ermineitstype.TheMIMEMagicFile#directivetellsthemodulewherethehintdefinitionsarelocated.#MIMEMagicFile/usr/share/magic.mimeMIMEMagicFileconf/magic#HostnameLookups:LogthenamesofclientsorjusttheirIPaddresses#e.g.,(on)or32(off).#Thedefaultisoffbecauseitdbeoverallbetterforthenetifpeople#hadtoknowinglytu

52、rnthisfeatureon,sinceenablingitmeansthat#eachclientrequestwillresultinATLEASTonelookuprequesttothe#nameserver.#日志中只記錄連接Apache服務(wù)器的客戶端IP地址,而不記錄其主機(jī)名HostnameLookupsOff#EnableMMAP:Controlwhethermemory-mappingisusedtodeliver#files(assumingthattheunderlyingOSsupportsit).#Thedefaultison;turnthisoffifyouserv

53、efromNFS-mounted#filesystems.Onsomesystems,turningitoff(regardlessof#filesystem)canimproveperformance;fordetails,pleasesee#/docs/2.2/mod/core.html#enablemmap#分發(fā)文件時是否啟用內(nèi)存映射功能,啟用時,在某些操作系統(tǒng)中可以提高性能#EnableMMAPoff#EnableSendfile:Controlwhetherthesendfilekernelsupportis#usedtodeliverfiles(assumingthattheOSs

54、upportsit).#Thedefaultison;turnthisoffifyouservefromNFS-mounted#filesystems.Pleasesee#/docs/2.2/mod/core.html#enablesendfile#分發(fā)文件時是否啟用sendfile內(nèi)核支持,如果使用NFS文件系統(tǒng),應(yīng)該要禁用#EnableSendfileoff#ErrorLog:Thelocationoftheerrorlogfile.#IfyoudonotspecifyanErrorLogdirectivewithina#container,errormessagesrelatingtot

55、hatvirtualhostwillbe#loggedhere.Ifyou*do*defineanerrorlogfilefora#container,thathostserrorswillbeloggedthereandnothere.#指定錯誤日志的存放位置,存放在/etc/httpd/logs/error_logErrorLoglogs/error_log#LogLevel:Controlthenumberofmessagesloggedtotheerror_log.#Possiblevaluesinclude:debug,info,notice,warn,error,crit,#ale

56、rt,emerg.#指定錯誤日志的記錄級別為warn及以上LogLevelwarn#Thefollowingdirectivesdefinesomeformatnicknamesforusewith#aCustomLogdirective(seebelow).#定義combine、common、referer、agent四種日志的格式LogFormat%h%l%u%t%r%s%b%Refereri%User-AgenticombinedLogFormat%h%l%u%t%r%s%bcommonLogFormat%Refereri-%UrefererLogFormat%User-agentiag

57、ent#combinedioincludesactualcountsofactualbytesreceived(%I)andsent(%O);this#requiresthemod_logiomoduletobeloaded.#LogFormat%h%l%u%t%r%s%b%Refereri%User-Agenti%I%Ocombinedio#Thelocationandformatoftheaccesslogfile(CommonLogfileFormat).#Ifyoudonotdefineanyaccesslogfileswithina#container,theywillbelogge

58、dhere.Contrariwise,ifyou*do*#defineper-accesslogfiles,transactionswillbe#loggedthereinand*not*inthisfile.#指定訪問日志的存放位置以及日志的格式,這里使用common格式#CustomLoglogs/access_logcommon#Ifyouwouldliketohaveseparateagentandrefererlogfiles,uncomment#thefollowingdirectives.#如果有需要,還可以將其他格式的日志同時記錄在相應(yīng)的日志文件中#CustomLoglogs/

59、referer_logreferer#CustomLoglogs/agent_logagent#Forasinglelogfilewithaccess,agent,andrefererinformation#(CombinedLogfileFormat),usethefollowingdirective:#如果只啟用一個訪問日志,默認(rèn)使用的是combined格式CustomLoglogs/access_logcombined#Optionallyaddalinecontainingtheserverversionandvirtualhost#nametoserver-generatedpage

60、s(internalerrordocuments,FTPdirectory#listings,mod_statusandmod_infooutputetc.,butnotCGIgenerated#documentsorcustomerrordocuments).#SettoEMailtoalsoincludeamailto:linktotheServerAdmin.#Settooneof:On|Off|EMail#設(shè)置在Apache自身產(chǎn)生的頁面中使用Apache服務(wù)器版本的簽名ServerSignatureOn#Aliases:Addhereasmanyaliasesasyouneed(wi

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論