




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Good is good, but better carries it.精益求精,善益求善。Linux環(huán)境Apache服務(wù)器配置與管理Linux環(huán)境Apache服務(wù)器配置與管理一、Apache的安裝首先使用下面的命令來查看系統(tǒng)是否已經(jīng)安裝了Apache可看到已經(jīng)安裝好了。另外也可以在終端窗口中執(zhí)行來查看httpd程序是否在執(zhí)行。下面介紹Apache服務(wù)器文件和目錄WEB站點(diǎn)目錄描述/var/wwwApacheWEB站點(diǎn)文件的目錄/var/www/htmlWEB站點(diǎn)的WEB文件/var/www/cgi-binCGI程序文件/var/www/html/manualApacheWEB服務(wù)器手冊(cè)/va
2、r/www/htmll/usagewebalizer程序文件配置文件/etc/httpd/conf基于目錄的配置文件,.htaccess文件包含對(duì)它所在目錄中文件的訪問控制指令/etc/httpd/conf/httpd.confApacheWEB服務(wù)器配置文件目錄/etc/httpd/conf/srm.conf主要的ApacheWEB服務(wù)器配置文件/etc/httpd/conf/access.conf用來處理文檔規(guī)范,配置文件類型昨未知的老式配置文件啟動(dòng)腳本/etc/rc.d/init.d/httpdWEB服務(wù)器守護(hù)進(jìn)程的啟動(dòng)腳本/etc/rc.d/rc3.d/S85httpd將運(yùn)行級(jí)目錄(/
3、etc/rc3.d)連接到目錄/etc/rc.d/init.d中的啟動(dòng)腳本應(yīng)用文件/usr/sbinApacheWEB服務(wù)器程序文件和應(yīng)用程序的位置/usr/doc/ApacheWEB服務(wù)器文檔/var/log/httpApache日志文件的位置二、啟動(dòng)和運(yùn)行Apache服務(wù)器其中一種是:另處一種是:httpd除了startstop命令之外,還有reload,condrestant,status命令,共6種狀態(tài)三.啟動(dòng)系統(tǒng)時(shí)自動(dòng)運(yùn)行Apache若想讓系統(tǒng)自動(dòng)執(zhí)行Apache,只需執(zhí)行setup命令,進(jìn)行TextModeSetupUtility界面,選中Systemservices中的:http
4、d服務(wù)即可.(源碼網(wǎng)整理:HYPERLINK/)當(dāng)然,還有一種更方便的圖形化方法.選擇應(yīng)用程序/系統(tǒng)設(shè)置/服務(wù)器設(shè)置/服務(wù)/四.httpd.conf文件詳細(xì)和配置舊版中的srm.conf與access.conf文件的內(nèi)容都被整合到httpd.conf文件中了.#BasedupontheNCSAserverconfigurationfilesoriginallybyRobMcCool.#ThisisthemainApacheserverconfigurationfile.Itcontainsthe#configurationdirectivesthatgivetheserveritsinstru
5、ctions.#Seefordetailedinformationabout#thedirectives.#這是Apache服務(wù)器主要配置文件。#它包含服務(wù)器的影響服務(wù)器運(yùn)行的配置指令。#參見以取得關(guān)于這些指令的詳細(xì)信息#DoNOTsimplyreadtheinstructionsinherewithoutunderstanding#whattheydo.Theyrehereonlyashintsorreminders.Ifyouareunsure#consulttheonlinedocs.Youhavebeenwarned.#不要只是簡(jiǎn)單的閱讀這些指令信息而不去理解它。#這里只是做了簡(jiǎn)單的說
6、明,如果你沒有參考在線文件,你就會(huì)被警告。#Theconfigurationdirectivesaregroupedintothreebasicsections:#1.DirectivesthatcontroltheoperationoftheApacheserverprocessasa#whole(theglobalenvironment).#2.Directivesthatdefinetheparametersofthemainordefaultserver,#whichrespondstorequeststhatarenthandledbyavirtualhost.#Thesedirec
7、tivesalsoprovidedefaultvaluesforthesettings#ofallvirtualhosts.#3.Settingsforvirtualhosts,whichallowWebrequeststobesentto#differentIPaddressesorhostnamesandhavethemhandledbythe#sameApacheserverprocess.#這些配置指令被分為下面三個(gè)部分:#1.控制整個(gè)Apache服務(wù)器行為的部分(即全局環(huán)境變量)#2.定義主要或者默認(rèn)服務(wù)參數(shù)的指令,也為所有虛擬主機(jī)提供默認(rèn)的設(shè)置參數(shù)#3.虛擬主機(jī)的設(shè)置參數(shù)#Conf
8、igurationandlogfilenames:Ifthefilenamesyouspecifyformany#oftheserverscontrolfilesbeginwith/(ordrive:/forWin32),the#serverwillusethatexplicitpath.Ifthefilenamesdo*not*begin#with/,thevalueofServerRootisprepended-sologs/foo.log#withServerRootsetto/etc/httpdwillbeinterpretedbythe#serveras/etc/httpd/logs
9、/foo.log.#配置和日志文件名:如果你指定的文件名以“/”開始(win32下以“dirver:/”),#服務(wù)器將使用絕對(duì)路徑,如果文件名不是以“/”開始的,那么它將把ServerRoot#的值附加在文件名的前面,例如,對(duì)“l(fā)ogs/foo.log,如果ServerRoot的值#為“/etc/httpd”,則該文件應(yīng)為“/etc/httpd/logs/foo.log”#Section1:GlobalEnvironment#ThedirectivesinthissectionaffecttheoveralloperationofApache,#suchasthenumberofconcurr
10、entrequestsitcanhandleorwhereit#canfinditsconfigurationfiles.#第一區(qū):全局環(huán)境參數(shù)#這里設(shè)置的參數(shù)將影響整個(gè)Apache服務(wù)器的行為;#例如Apache能夠處理的并發(fā)請(qǐng)求的數(shù)量等。#ServerRoot:Thetopofthedirectorytreeunderwhichtheservers#configuration,error,andlogfilesarekept.#ServerRoot:指出服務(wù)器保存其配置、出錯(cuò)和日志文件等的根目錄。#NOTE!IfyouintendtoplacethisonanNFS(orotherwise
11、network)#mountedfilesystemthenpleasereadtheLockFiledocumentation#(availableat);#youwillsaveyourselfalotoftrouble.#DoNOTaddaslashattheendofthedirectorypath.#ServerRoot/etc/httpd#注意!如果你想要將它指定為NFS或其它網(wǎng)絡(luò)上的位置,#請(qǐng)一定要去閱讀與LockFile有關(guān)的文檔(可能在#)。#這將會(huì)使你自己也能解決很多問題。#路徑的結(jié)尾不要添加斜線。#ServerRoot/etc/httpd#PidFile:Thefilei
12、nwhichtheservershouldrecorditsprocess#identificationnumberwhenitstarts.#PidFilerun/httpd.pid#串行訪問的鎖文件必須保存在本地磁盤上#PidFile:記錄服務(wù)器啟動(dòng)進(jìn)程號(hào)的文件。#Timeout:Thenumberofsecondsbeforereceivesandsendstimeout.#Timeout120#Timeout:接收和發(fā)送前超時(shí)秒數(shù)#Timeout120#KeepAlive:Whetherornottoallowpersistentconnections(morethan#onerequ
13、estperconnection).SettoOfftodeactivate.#KeepAliveOff#KeepAlive:是否允許穩(wěn)固的連接(每個(gè)連接有多個(gè)請(qǐng)求),#設(shè)為Off則停用。#KeepAliveOff#MaxKeepAliveRequests:Themaximumnumberofrequeststoallow#duringapersistentconnection.Setto0toallowanunlimitedamount.#Werecommendyouleavethisnumberhigh,formaximumperformance.#MaxKeepAliveRequests
14、100#MaxKeepAliveRequests:在穩(wěn)固連接期間允許的最大請(qǐng)求數(shù),#設(shè)為0表示無限制接入。#我們推薦你將其設(shè)為一個(gè)較大的值,以便提高性能MaxKeepAliveRequests100#KeepAliveTimeout:Numberofsecondstowaitforthenextrequestfromthe#sameclientonthesameconnection.#KeepAliveTimeout15#KeepAliveTimeout:在同一個(gè)連接上從同一臺(tái)客戶上接收請(qǐng)求的秒數(shù)#KeepAliveTimeout15#Server-PoolSizeRegulation(MPM
15、specific)#Server-Pool大小設(shè)定(針對(duì)MPM的)#preforkMPM#StartServers:numberofserverprocessestostart#MinSpareServers:minimumnumberofserverprocesseswhicharekeptspare#MaxSpareServers:maximumnumberofserverprocesseswhicharekeptspare#ServerLimit:maximumvalueforMaxClientsforthelifetimeoftheserver#MaxClients:maximumnu
16、mberofserverprocessesallowedtostart#MaxRequestsPerChild:maximumnumberofrequestsaserverprocessservesStartServers8MinSpareServers5MaxSpareServers20ServerLimit256MaxClients256MaxRequestsPerChild4000#preforkMPM#StartServers:啟動(dòng)時(shí)服務(wù)器啟動(dòng)的進(jìn)程數(shù)#MinSpareServers:保有的備用進(jìn)程的最小數(shù)目#MaxSpareServers:保有的備用進(jìn)程的最大數(shù)目#MaxClient
17、s:服務(wù)器允許啟動(dòng)的最大進(jìn)程數(shù)#MaxRequestsPerChild:一個(gè)服務(wù)進(jìn)程允許的最大請(qǐng)求數(shù)StartServers8MinSpareServers5MaxSpareServers20MaxClients256MaxRequestPerChild4000#workerMPM#StartServers:initialnumberofserverprocessestostart#MaxClients:maximumnumberofsimultaneousclientconnections#MinSpareThreads:minimumnumberofworkerthreadswhichar
18、ekeptspare#MaxSpareThreads:maximumnumberofworkerthreadswhicharekeptspare#ThreadsPerChild:constantnumberofworkerthreadsineachserverprocess#MaxRequestsPerChild:maximumnumberofrequestsaserverprocessservesStartServers2MaxClients150MinSpareThreads25MaxSpareThreads75ThreadsPerChild25MaxRequestsPerChild0#w
19、orkerMPM#StartServers:服務(wù)器啟動(dòng)時(shí)的服務(wù)進(jìn)程數(shù)目#MaxClients:允許同時(shí)連接的最大用戶數(shù)目#MinSpareThreads:保有的最小工作線程數(shù)目#MaxSpareThreads:允許保有的最大工作線程數(shù)目#ThreadsPerChild:每個(gè)服務(wù)進(jìn)程中的工作線程常數(shù)#MaxRequestsPerChild:服務(wù)進(jìn)程中允許的最大請(qǐng)求數(shù)目StartServers2MaxClients150MinSpareThreads25MaxSpareThreads75ThreadsPerChild25MaxRequestsPerChild0#Listen:Allowsyouto
20、bindApachetospecificIPaddressesand/or#ports,inadditiontothedefault.Seealsothe#directive.#ChangethistoListenonspecificIPaddressesasshownbelowto#preventApachefromglommingontoallboundIPaddresses()#Listen8:80Listen80#Listen:允許你綁定Apache服務(wù)到指定的IP地址和端口上,以取代默認(rèn)值#參見指令#使用如下命令使Apache只在指定的IP地址上監(jiān)聽,#以防止它在IP地址上監(jiān)聽#Li
21、sten8:80Listen80#DynamicSharedObject(DSO)Support#TobeabletousethefunctionalityofamodulewhichwasbuiltasaDSOyou#havetoplacecorrespondingLoadModulelinesatthislocationsothe#directivescontainedinitareactuallyavailable_before_theyareused.#Staticallycompiledmodules(thoselistedbyhttpd-l)donotneed#tobeloaded
22、here.#Example:#LoadModulefoo_modulemodules/mod_foo.so#動(dòng)態(tài)共享支持(DSO)#為了能夠使用那些以DSO模式編譯的模塊中的函數(shù),你必須有相應(yīng)的“LoadModule”行,#因此,在這里包含了這些指令,以便能在使用它之前激活。#那些靜態(tài)編譯的模塊不需要在這里列出(即以“httpd-l”列出的模塊)#示例:#LoadModulefoo_modulemodules/mod_foo.so#LoadModuleaccess_modulemodules/mod_access.soLoadModuleauth_modulemodules/mod_auth.
23、soLoadModuleauth_anon_modulemodules/mod_auth_anon.soLoadModuleauth_dbm_modulemodules/mod_auth_dbm.soLoadModuleauth_digest_modulemodules/mod_auth_digest.soLoadModuleldap_modulemodules/mod_ldap.soLoadModuleauth_ldap_modulemodules/mod_auth_ldap.soLoadModuleinclude_modulemodules/mod_include.soLoadModule
24、log_config_modulemodules/mod_log_config.soLoadModuleenv_modulemodules/mod_env.soLoadModulemime_magic_modulemodules/mod_mime_magic.soLoadModulecern_meta_modulemodules/mod_cern_meta.soLoadModuleexpires_modulemodules/mod_expires.soLoadModuledeflate_modulemodules/mod_deflate.soLoadModuleheaders_modulemo
25、dules/mod_headers.soLoadModuleusertrack_modulemodules/mod_usertrack.soLoadModulesetenvif_modulemodules/mod_setenvif.soLoadModulemime_modulemodules/mod_mime.soLoadModuledav_modulemodules/mod_dav.soLoadModulestatus_modulemodules/mod_status.soLoadModuleautoindex_modulemodules/mod_autoindex.soLoadModule
26、asis_modulemodules/mod_asis.soLoadModuleinfo_modulemodules/mod_info.soLoadModuledav_fs_modulemodules/mod_dav_fs.soLoadModulevhost_alias_modulemodules/mod_vhost_alias.soLoadModulenegotiation_modulemodules/mod_negotiation.soLoadModuledir_modulemodules/mod_dir.soLoadModuleimap_modulemodules/mod_imap.so
27、LoadModuleactions_modulemodules/mod_actions.soLoadModulespeling_modulemodules/mod_speling.soLoadModuleuserdir_modulemodules/mod_userdir.soLoadModulealias_modulemodules/mod_alias.soLoadModulerewrite_modulemodules/mod_rewrite.soLoadModuleproxy_modulemodules/mod_proxy.soLoadModuleproxy_ftp_modulemodule
28、s/mod_proxy_ftp.soLoadModuleproxy_http_modulemodules/mod_proxy_http.soLoadModuleproxy_connect_modulemodules/mod_proxy_connect.soLoadModulecache_modulemodules/mod_cache.soLoadModulesuexec_modulemodules/mod_suexec.soLoadModuledisk_cache_modulemodules/mod_disk_cache.soLoadModulefile_cache_modulemodules
29、/mod_file_cache.soLoadModulemem_cache_modulemodules/mod_mem_cache.soLoadModulecgi_modulemodules/mod_cgi.so#Loadconfigfilesfromtheconfigdirectory/etc/httpd/conf.d.#Includeconf.d/*.conf#ExtendedStatuscontrolswhetherApachewillgeneratefullstatus#information(ExtendedStatusOn)orjustbasicinformation(Extend
30、edStatus#Off)whentheserver-statushandleriscalled.ThedefaultisOff.#ExtendedStatusOn#ExtendedStatus:當(dāng)調(diào)用“server-status”時(shí),控制Apache是產(chǎn)生“全”狀態(tài)#信息(ExtendedStatusOn),還是產(chǎn)生基本信息(ExtendedStatusOff)。#默認(rèn)為off#ExtendedStatusOn#Section2:Mainserverconfiguration#Thedirectivesinthissectionsetupthevaluesusedbythemain#serv
31、er,whichrespondstoanyrequeststhatarenthandledbya#definition.Thesevaluesalsoprovidedefaultsfor#anycontainersyoumaydefinelaterinthefile.#Allofthesedirectivesmayappearinsidecontainers,#inwhichcasethesedefaultsettingswillbeoverriddenforthe#virtualhostbeingdefined.#第二區(qū):“主”服務(wù)配置#這一區(qū)建立被“主”服務(wù)器用的指令值,以回應(yīng)那些不被#定
32、義處理的任何請(qǐng)求。#這些數(shù)值也提供默認(rèn)值給后面定義的容器。#如果中有定義,那么這里定義的指令值將被#中的定義所覆蓋。#Ifyouwishhttpdtorunasadifferentuserorgroup,youmustrun#httpdasrootinitiallyanditwillswitch.#User/Group:Thename(or#number)oftheuser/grouptorunhttpdas.#.OnSCO(ODT3)useUsernouserandGroupnogroup.#.OnHPUXyoumaynotbeabletousesharedmemoryasnobody,an
33、dthe#suggestedworkaroundistocreateauserwwwandusethatuser.#NOTEthatsomekernelsrefusetosetgid(Group)orsemctl(IPC_SET)#whenthevalueof(unsigned)Groupisabove60000;#dontuseGroup#-1onthesesystems!#UserapacheGroupapache#如果你想使httpd以另外的用戶或組來運(yùn)行,你必須在開始時(shí)以root方式啟動(dòng)#然后再將它切換為你想要使用的用戶或組。#User/Group:運(yùn)行httpd的用戶和組#在SCO(
34、ODT3)上使用“Usernouser”和“Groupnogroup”#在HPUX上,你可能不能以nobody身份使用共享內(nèi)存,建議創(chuàng)建一個(gè)www用戶。#注意一些核心(kernel)在組ID大于60000時(shí)拒絕setgid(Group)或semctl(IPC_SET),#建議在這些系統(tǒng)上不要使用“Group#-1”。#UserapacheGroupapache#ServerAdmin:Youraddress,whereproblemswiththeservershouldbe#e-mailed.Thisaddressappearsonsomeserver-generatedpages,such
35、#aserrordocuments.e.g.HYPERLINKmailto:adminadmin#ServerAdminHYPERLINKmailto:rootlocalhostrootlocalhost#ServerAdmin:你的郵件地址,當(dāng)發(fā)生問題時(shí)Apache將向你發(fā)出郵件。#作為一個(gè)出錯(cuò)文檔,這個(gè)地址顯示在server-generated頁(yè)上,#例如:HYPERLINKmailto:adminadmin#ServerAdminHYPERLINKmailto:rootlocalhostrootlocalhost#ServerNamegivesthenameandportthatthes
36、erverusestoidentifyitself.#Thiscanoftenbedeterminedautomatically,butwerecommendyouspecify#itexplicitlytopreventproblemsduringstartup.#IfthisisnotsettovalidDNSnameforyourhost,server-generated#redirectionswillnotwork.SeealsotheUseCanonicalNamedirective.#IfyourhostdoesnthavearegisteredDNSname,enteritsI
37、Paddresshere.#Youwillhavetoaccessitbyitsaddressanyway,andthiswillmake#redirectionsworkinasensibleway.#ServerN:80#ServerName指定Apache用于識(shí)別自身的名字和端口號(hào)。#通常這個(gè)值是自動(dòng)指定的,但是我們推薦你顯式的指定它以防止啟動(dòng)時(shí)出錯(cuò)#如果你為你的主機(jī)指定了一個(gè)無效的DNS名,server-generated重定向?qū)⒉荒芄ぷ鳌?參見UseCanonicalName指令#如果你的主機(jī)沒有注冊(cè)DNS名,在這里鍵入它的IP地址#無論如何,你必須使用它的IP地址來提供服務(wù),#這里
38、使用一種容易理解的方式重定向服務(wù)ServerN:80#UseCanonicalName:DetermineshowApacheconstructsself-referencing#URLsandtheSERVER_NAMEandSERVER_PORTvariables.#WhensetOff,ApachewillusetheHostnameandPortsupplied#bytheclient.WhensetOn,Apachewillusethevalueofthe#ServerNamedirective.#UseCanonicalNameOff#UseCanonicalName:決定Apac
39、he如何構(gòu)造URLS和SERVER_NAME和SERVER_PORT的指令。#當(dāng)設(shè)置為“Off”時(shí),Apache會(huì)使用用戶端提供的主機(jī)名和端口號(hào)。#當(dāng)設(shè)置為“On”,Apache會(huì)使用ServerName指令的值。#UseCanonicalNameOff#DocumentRoot:Thedirectoryoutofwhichyouwillserveyour#documents.Bydefault,allrequestsaretakenfromthisdirectory,but#symboliclinksandaliasesmaybeusedtopointtootherlocations.#Do
40、cumentRoot/var/www/html#DocumentRoot:你的文檔的根目錄。默認(rèn)情況下,所有的請(qǐng)求從這個(gè)目錄進(jìn)行應(yīng)答。#但是可以使用符號(hào)鏈接和別名來指向到其他的位置。#DocumentRoot/var/www/html#EachdirectorytowhichApachehasaccesscanbeconfiguredwithrespect#towhichservicesandfeaturesareallowedand/ordisabledinthat#directory(anditssubdirectories).#First,weconfigurethedefaulttob
41、eaveryrestrictivesetof#features.#OptionsFollowSymLinksAllowOverrideNone#Apache可以存取的每個(gè)目錄都可以配置存取權(quán)限(包括它的子目錄)。#首先,我們配置一個(gè)高限制的特征。#這將禁止訪問文件系統(tǒng)所在的目錄,并添加你希望允許訪問的目錄塊。#如下所示OrderDeny,AllowDenyfromall#Notethatfromthispointforwardyoumustspecificallyallow#particularfeaturestobeenabled-soifsomethingsnotworkingas#you
42、mightexpect,makesurethatyouhavespecificallyenabledit#below.#注意從這里開始你一定要明確地允許哪些特別的特征能夠被使用。#-所以,如果Apache沒有象你所期待的那樣工作的話,#請(qǐng)檢查你是否在下面明確的指定它可用。#ThisshouldbechangedtowhateveryousetDocumentRootto.#這將改變到你設(shè)置的DocumentRoot#PossiblevaluesfortheOptionsdirectiveareNone,All,#oranycombinationof:#IndexesIncludesFollow
43、SymLinksSymLinksifOwnerMatchExecCGIMultiViews#NotethatMultiViewsmustbenamed*explicitly*OptionsAll#doesntgiveittoyou.#TheOptionsdirectiveisbothcomplicatedandimportant.Pleasesee#HYPERLINK/docs-2.0/mod/core.htmlloptionsurl/docs-2.0/mod/core.html#options/url#formoreinformation.#OptionsIndexesFollowSymLi
44、nks#Options:這個(gè)指令的值可以是“None”,“All”,或者下列選項(xiàng)的任意組合:#IndexesIncludesFollowSymLinksSymLinksifOwnerMatchExecCGIMultiViews#注意,“MultiViews”必須被顯式的指定,“OptionsAll”不能為你提供這個(gè)特性。#這個(gè)指令既復(fù)雜又重要,請(qǐng)參見#“url/docs-2.0/mod/core.html#optioins/url”以取得更多的信息。#OptionsIndexesFollowSymLinks#AllowOverridecontrolswhatdirectivesmaybepla
45、cedin.htaccessfiles.#ItcanbeAll,None,oranycombinationofthekeywords:#OptionsFileInfoAuthConfigLimit#AllowOverrideNone#AllowOverride控制那些被放置在.htaccess文件中的指令。#它可以是“All”,“None”,或者下列指令的組合:#OptionsFileInfoAuthConfigLimit#AllowOverrideNone#Controlswhocangetstufffromthisserver.#Orderallow,denyAllowfromall#控制
46、誰(shuí)可以獲得服務(wù)。#Orderallow,denyAllowfromall#UserDir:Thenameofthedirectorythatisappendedontoausershome#directoryifauserrequestisreceived.#UserDir:指定在得到一個(gè)user請(qǐng)求時(shí)將會(huì)添加到用戶home目錄后的目錄名。#UserDir:Thenameofthedirectorythatisappendedontoausershome#directoryifauserrequestisreceived.#Thepathtotheenduseraccountpublic_ht
47、mldirectorymustbe#accessibletothewebserveruserid.Thisusuallymeansthatuserid#musthavepermissionsof711,userid/public_htmlmusthavepermissions#of755,anddocumentscontainedthereinmustbeworld-readable.#Otherwise,theclientwillonlyreceivea403Forbiddenmessage.#Seealso:HYPERLINK/docs/misc/FAQ.htmllforbiddenurl
48、/docs/misc/FAQ.html#forbidden/url#UserDirisdisabledbydefaultsinceitcanconfirmthepresence#ofausernameonthesystem(dependingonhomedirectory#permissions).#UserDirdisable#Toenablerequeststo/user/toservetheuserspublic_html#directory,removetheUserDirdisablelineabove,anduncomment#thefollowinglineinstead:#Us
49、erDirpublic_html#ControlaccesstoUserDirdirectories.Thefollowingisanexample#forasitewherethesedirectoriesarerestrictedtoread-only.#AllowOverrideFileInfoAuthConfigLimit#OptionsMultiViewsIndexesSymLinksIfOwnerMatchIncludesNoExec#Orderallow,deny#Allowfromall#Orderdeny,allow#Denyfromall#DirectoryIndex:se
50、tsthefilethatApachewillserveifadirectory#isrequested.#Theindex.html.varfile(atype-map)isusedtodelivercontent-#negotiateddocuments.TheMultiViewsOptioncanbeusedforthe#samepurpose,butitismuchslower.#DirectoryIndexindex.htmlindex.html.var#DirectoryIndex:定義請(qǐng)求是一個(gè)目錄時(shí),Apache向用戶提供服務(wù)的文件名#index.html.var文件(一個(gè)類型
51、映象文件)用于提供一個(gè)文檔處理列表,#出于同樣的目的,也可以使用MultiViews選項(xiàng),但是它會(huì)非常慢。#DirectoryIndexindex.htmlindex.html.var#AccessFileName:Thenameofthefiletolookforineachdirectory#foradditionalconfigurationdirectives.SeealsotheAllowOverride#directive.#AccessFileName.htaccess#AccessFileName:在每個(gè)目錄中查詢?yōu)槟夸浱峁└郊优渲弥噶畹奈募奈募?參見AllowOverr
52、ide指令。#AccessFileName.htaccess#Thefollowinglinesprevent.htaccessand.htpasswdfilesfrombeing#viewedbyWebclients.#Orderallow,denyDenyfromall#下面的行防止.htaccess和.htpasswd文件被Web客戶查看。#Orderallow,denyDenyfromall#TypesConfigdescribeswherethemime.typesfile(orequivalent)is#tobefound.#TypesConfig/etc/mime.types#T
53、ypeconfig:定義在哪里查詢mime.types文件。#TypeConfigconf/mime.types#DefaultTypeisthedefaultMIMEtypetheserverwilluseforadocument#ifitcannototherwisedetermineone,suchasfromfilenameextensions.#IfyourservercontainsmostlytextorHTMLdocuments,text/plainis#agoodvalue.Ifmostofyourcontentisbinary,suchasapplications#orim
54、ages,youmaywanttouseapplication/octet-streaminsteadto#keepbrowsersfromtryingtodisplaybinaryfilesasthoughtheyare#text.#DefaultTypetext/plain#DefaultType:定義當(dāng)不能確定MIME類型時(shí)服務(wù)器提供的默認(rèn)MIME類型。#如果你的服務(wù)主要包含text或HTML文檔,“text/plain”是一個(gè)好的選擇;#如果大多是二進(jìn)制文檔,諸如軟件或圖像,你應(yīng)使用#“application/octer-stream”來防止瀏覽器象顯示文本那樣顯示二進(jìn)制文件。#Def
55、aultTypetext/plain#Themod_mime_magicmoduleallowstheservertousevarioushintsfromthe#contentsofthefileitselftodetermineitstype.TheMIMEMagicFile#directivetellsthemodulewherethehintdefinitionsarelocated.#MIMEMagicFile/usr/share/magic.mimeMIMEMagicFileconf/magic#mod_mime_magic允許服務(wù)器從自己定義自己類型的文件中使用不同的線索(hin
56、ts),#這個(gè)MIMEMagicFile指令定義hints定義所在的文件。#MIMEMagicFileconf/magic#HostnameLookups:LogthenamesofclientsorjusttheirIPaddresses#e.g.,HYPERLINKurl/url(on)or32(off).#Thedefaultisoffbecauseitdbeoverallbetterforthenetifpeople#hadtoknowinglyturnthisfeatureon,sinceenablingitmeansthat#eachclientrequestwillresulti
57、nATLEASTonelookuprequesttothe#nameserver.#HostnameLookupsOff#HostnameLookups:指定記錄用戶端的名字還是IP地址,例如,本指令為on時(shí)#記錄主機(jī)名,如HYPERLINKurl/url;為off時(shí)記錄IP地址,32。#默認(rèn)值為off,這要比設(shè)為on好得多,因?yàn)槿绻O(shè)為on則每個(gè)用戶端請(qǐng)求都將會(huì)#至少造成對(duì)nameserver進(jìn)行一次查詢。#HostnameLookupsOff#EnableMMAP:Controlwhethermemory-mappingisusedtodeliver#files(assumingthatt
58、heunderlyingOSsupportsit).#Thedefaultison;turnthisoffifyouservefromNFS-mounted#filesystems.Onsomesystems,turningitoff(regardlessof#filesystem)canimproveperformance;fordetails,pleasesee#HYPERLINK/docs-2.0/mod/core.htmllenablemmapurl/docs-2.0/mod/core.html#enablemmap/url#EnableMMAPoff#EnableMMAP:控制是否進(jìn)
59、行內(nèi)存轉(zhuǎn)儲(chǔ)(如果操作系統(tǒng)支持的話)。#默認(rèn)為on,如果你的服務(wù)器安裝在網(wǎng)絡(luò)文件系統(tǒng)上(NFS),請(qǐng)關(guān)閉它。#在一些系統(tǒng)上,關(guān)閉它會(huì)提升系統(tǒng)性能(與文件系統(tǒng)類型無關(guān));#具體情況請(qǐng)參閱HYPERLINK/docs-2.0/mod/core.htmllenablemmapurl/docs-2.0/mod/core.html#enablemmap/url#EnableMMAPoff#EnableSendfile:Controlwhetherthesendfilekernelsupportis#usedtodeliverfiles(assumingthattheOSsupportsit).#Thede
60、faultison;turnthisoffifyouservefromNFS-mounted#filesystems.Pleasesee#HYPERLINK/docs-2.0/mod/core.htmllenablesendfileurl/docs-2.0/mod/core.html#enablesendfile/url#EnableSendfileoff#EnableSendfile:控制是否使用sendfilekernel支持發(fā)送文件#(如果操作系統(tǒng)支持的話)。默認(rèn)為on,如果你的服務(wù)器安裝在網(wǎng)絡(luò)文件系統(tǒng)#(NFS)上,請(qǐng)你關(guān)閉它。#參見HYPERLINK/docs-2.0/mod/cor
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 中國(guó)銀行法律顧問合同范本
- 勞務(wù)分包個(gè)人合同范本
- 中醫(yī)飲售賣合同范本
- 剩余產(chǎn)品合同范本
- 農(nóng)業(yè)土豆銷售合同范本
- 公務(wù)車服務(wù)合同范本
- 個(gè)人包車協(xié)議合同范本
- 制定企業(yè)合同范本
- 個(gè)人餐館轉(zhuǎn)讓合同范本
- 單位買車合同范例
- 大學(xué)學(xué)院學(xué)生獎(jiǎng)助資金及相關(guān)經(jīng)費(fèi)發(fā)放管理暫行辦法
- 2022蘇教版科學(xué)五年級(jí)下冊(cè)全冊(cè)優(yōu)質(zhì)教案教學(xué)設(shè)計(jì)
- 加油員的安全生產(chǎn)責(zé)任制
- 2023年R2移動(dòng)式壓力容器充裝操作證考試題及答案(完整版)
- 九年級(jí)物理實(shí)驗(yàn)記錄單
- 2022年湖北省高中學(xué)業(yè)水平考試真題-音樂學(xué)科
- 提高屋面防水施工質(zhì)量年QC成果
- 部編初中語(yǔ)文古詩(shī)詞按作者分類梳理
- 博朗IRT6520中文說明書家用版
- 旅行社運(yùn)營(yíng)實(shí)務(wù)電子課件 1.1 初識(shí)旅行社
- 【讀書如熬粥閱讀答案】讀書如熬粥閱讀答案
評(píng)論
0/150
提交評(píng)論