为了账号安全,请及时绑定邮箱和手机立即绑定

apache对php文件的支持

apache对php文件的支持

ABOUTYOU 2019-04-14 11:28:32
我的php文件放到apache下运行不了,想问要怎么配置他的httpd.config用了网上很多的方法都配置不成功##ThisisthemainApacheHTTPserverconfigurationfile.Itcontainsthe#configurationdirectivesthatgivetheserveritsinstructions.#Seefordetailedinformation.#Inparticular,see##foradiscussionofeachconfigurationdirective.##DoNOTsimplyreadtheinstructionsinherewithoutunderstanding#whattheydo.They'rehereonlyashintsorreminders.Ifyouareunsure#consulttheonlinedocs.Youhavebeenwarned.##Configurationandlogfilenames:Ifthefilenamesyouspecifyformany#oftheserver'scontrolfilesbeginwith"/"(or"drive:/"forWin32),the#serverwillusethatexplicitpath.Ifthefilenamesdo*not*begin#with"/",thevalueofServerRootisprepended--so"logs/foo.log"#withServerRootsetto"D:/Apache2.2.19/httpd-2.2.19-win64/httpd-2.2-x64"willbeinterpretedbythe#serveras"D:/Apache2.2.19/httpd-2.2.19-win64/httpd-2.2-x64/logs/foo.log".##NOTE:Wherefilenamesarespecified,youmustuseforwardslashes#insteadofbackslashes(e.g.,"c:/apache"insteadof"c:\apache").#Ifadriveletterisomitted,thedriveonwhichhttpd.exeislocated#willbeusedbydefault.Itisrecommendedthatyoualwayssupply#anexplicitdriveletterinabsolutepathstoavoidconfusion.##ServerRoot:Thetopofthedirectorytreeunderwhichtheserver's#configuration,error,andlogfilesarekept.##Donotaddaslashattheendofthedirectorypath.Ifyoupoint#ServerRootatanon-localdisk,besuretopointtheLockFiledirective#atalocaldisk.IfyouwishtosharethesameServerRootformultiple#httpddaemons,youwillneedtochangeatleastLockFileandPidFile.#ServerRoot"D:/Apache2.2.19/httpd-2.2.19-win64/httpd-2.2-x64"##Listen:AllowsyoutobindApachetospecificIPaddressesand/or#ports,insteadofthedefault.Seealsothe#directive.##ChangethistoListenonspecificIPaddressesasshownbelowto#preventApachefromglommingontoallboundIPaddresses.##Listen12.34.56.78:80Listen8080##DynamicSharedObject(DSO)Support##TobeabletousethefunctionalityofamodulewhichwasbuiltasaDSOyou#havetoplacecorresponding`LoadModule'linesatthislocationsothe#directivescontainedinitareactuallyavailable_before_theyareused.#Staticallycompiledmodules(thoselistedby`httpd-l')donotneed#tobeloadedhere.##Example:#LoadModulefoo_modulemodules/mod_foo.so#LoadModuleactions_modulemodules/mod_actions.soLoadModulealias_modulemodules/mod_alias.soLoadModuleasis_modulemodules/mod_asis.soLoadModuleauth_basic_modulemodules/mod_auth_basic.so#LoadModuleauth_digest_modulemodules/mod_auth_digest.so#LoadModuleauthn_alias_modulemodules/mod_authn_alias.so#LoadModuleauthn_anon_modulemodules/mod_authn_anon.so#LoadModuleauthn_dbd_modulemodules/mod_authn_dbd.so#LoadModuleauthn_dbm_modulemodules/mod_authn_dbm.soLoadModuleauthn_default_modulemodules/mod_authn_default.soLoadModuleauthn_file_modulemodules/mod_authn_file.so#LoadModuleauthnz_ldap_modulemodules/mod_authnz_ldap.so#LoadModuleauthz_dbm_modulemodules/mod_authz_dbm.soLoadModuleauthz_default_modulemodules/mod_authz_default.soLoadModuleauthz_groupfile_modulemodules/mod_authz_groupfile.soLoadModuleauthz_host_modulemodules/mod_authz_host.so#LoadModuleauthz_owner_modulemodules/mod_authz_owner.soLoadModuleauthz_user_modulemodules/mod_authz_user.soLoadModuleautoindex_modulemodules/mod_autoindex.so#LoadModulecache_modulemodules/mod_cache.so#LoadModulecern_meta_modulemodules/mod_cern_meta.soLoadModulecgi_modulemodules/mod_cgi.so#LoadModulecharset_lite_modulemodules/mod_charset_lite.so#LoadModuledav_modulemodules/mod_dav.so#LoadModuledav_fs_modulemodules/mod_dav_fs.so#LoadModuledav_lock_modulemodules/mod_dav_lock.so#LoadModuledbd_modulemodules/mod_dbd.so#LoadModuledeflate_modulemodules/mod_deflate.soLoadModuledir_modulemodules/mod_dir.so#LoadModuledisk_cache_modulemodules/mod_disk_cache.so#LoadModuledumpio_modulemodules/mod_dumpio.soLoadModuleenv_modulemodules/mod_env.so#LoadModuleexpires_modulemodules/mod_expires.so#LoadModuleext_filter_modulemodules/mod_ext_filter.so#LoadModulefile_cache_modulemodules/mod_file_cache.so#LoadModulefilter_modulemodules/mod_filter.so#LoadModuleheaders_modulemodules/mod_headers.so#LoadModuleident_modulemodules/mod_ident.so#LoadModuleimagemap_modulemodules/mod_imagemap.soLoadModuleinclude_modulemodules/mod_include.so#LoadModuleinfo_modulemodules/mod_info.soLoadModuleisapi_modulemodules/mod_isapi.so#LoadModuleldap_modulemodules/mod_ldap.so#LoadModulelogio_modulemodules/mod_logio.soLoadModulelog_config_modulemodules/mod_log_config.so#LoadModulelog_forensic_modulemodules/mod_log_forensic.so#LoadModulemem_cache_modulemodules/mod_mem_cache.soLoadModulemime_modulemodules/mod_mime.so#LoadModulemime_magic_modulemodules/mod_mime_magic.soLoadModulenegotiation_modulemodules/mod_negotiation.so#LoadModuleproxy_modulemodules/mod_proxy.so#LoadModuleproxy_ajp_modulemodules/mod_proxy_ajp.so#LoadModuleproxy_balancer_modulemodules/mod_proxy_balancer.so#LoadModuleproxy_connect_modulemodules/mod_proxy_connect.so#LoadModuleproxy_ftp_modulemodules/mod_proxy_ftp.so#LoadModuleproxy_http_modulemodules/mod_proxy_http.so#LoadModuleproxy_scgi_modulemodules/mod_proxy_scgi.so#LoadModulereqtimeout_modulemodules/mod_reqtimeout.soLoadModulerewrite_modulemodules/mod_rewrite.soLoadModulesetenvif_modulemodules/mod_setenvif.so#LoadModulespeling_modulemodules/mod_speling.so#LoadModulessl_modulemodules/mod_ssl.so#LoadModulestatus_modulemodules/mod_status.so#LoadModulesubstitute_modulemodules/mod_substitute.so#LoadModuleunique_id_modulemodules/mod_unique_id.so#LoadModuleuserdir_modulemodules/mod_userdir.so#LoadModuleusertrack_modulemodules/mod_usertrack.so#LoadModuleversion_modulemodules/mod_version.so#LoadModulevhost_alias_modulemodules/mod_vhost_alias.so##Ifyouwishhttpdtorunasadifferentuserorgroup,youmustrun#httpdasrootinitiallyanditwillswitch.##User/Group:Thename(or#number)oftheuser/grouptorunhttpdas.#Itisusuallygoodpracticetocreateadedicateduserandgroupfor#runninghttpd,aswithmostsystemservices.#UserdaemonGroupdaemon#'Main'serverconfiguration##Thedirectivesinthissectionsetupthevaluesusedbythe'main'#server,whichrespondstoanyrequeststhataren'thandledbya#definition.Thesevaluesalsoprovidedefaultsfor#anycontainersyoumaydefinelaterinthefile.##Allofthesedirectivesmayappearinsidecontainers,#inwhichcasethesedefaultsettingswillbeoverriddenforthe#virtualhostbeingdefined.###ServerAdmin:Youraddress,whereproblemswiththeservershouldbe#e-mailed.Thisaddressappearsonsomeserver-generatedpages,such#aserrordocuments.e.g.admin@your-domain.com#ServerAdminadmin@example.com##ServerNamegivesthenameandportthattheserverusestoidentifyitself.#Thiscanoftenbedeterminedautomatically,butwerecommendyouspecify#itexplicitlytopreventproblemsduringstartup.##Ifyourhostdoesn'thavearegisteredDNSname,enteritsIPaddresshere.##ServerNamewww.example.com:80##DocumentRoot:Thedirectoryoutofwhichyouwillserveyour#documents.Bydefault,allrequestsaretakenfromthisdirectory,but#symboliclinksandaliasesmaybeusedtopointtootherlocations.#DocumentRoot"D:/Apache2.2.19/httpd-2.2.19-win64/httpd-2.2-x64/htdocs"##EachdirectorytowhichApachehasaccesscanbeconfiguredwithrespect#towhichservicesandfeaturesareallowedand/ordisabledinthat#directory(anditssubdirectories).##First,weconfigurethe"default"tobeaveryrestrictivesetof#features.#OptionsFollowSymLinksAllowOverrideNoneOrderdeny,allowDenyfromall##Notethatfromthispointforwardyoumustspecificallyallow#particularfeaturestobeenabled-soifsomething'snotworkingas#youmightexpect,makesurethatyouhavespecificallyenabledit#below.###ThisshouldbechangedtowhateveryousetDocumentRootto.###PossiblevaluesfortheOptionsdirectiveare"None","All",#oranycombinationof:#IndexesIncludesFollowSymLinksSymLinksifOwnerMatchExecCGIMultiViews##Notethat"MultiViews"mustbenamed*explicitly*---"OptionsAll"#doesn'tgiveittoyou.##TheOptionsdirectiveisbothcomplicatedandimportant.Pleasesee#http://httpd.apache.org/docs/2.2/mod/core.html#options#formoreinformation.#OptionsIndexesFollowSymLinks##AllowOverridecontrolswhatdirectivesmaybeplacedin.htaccessfiles.#Itcanbe"All","None",oranycombinationofthekeywords:#OptionsFileInfoAuthConfigLimit#AllowOverrideNone##Controlswhocangetstufffromthisserver.#Orderallow,denyAllowfromall##DirectoryIndex:setsthefilethatApachewillserveifadirectory#isrequested.#DirectoryIndexindex.html##Thefollowinglinesprevent.htaccessand.htpasswdfilesfrombeing#viewedbyWebclients.#Orderallow,denyDenyfromallSatisfyAll##ErrorLog:Thelocationoftheerrorlogfile.#IfyoudonotspecifyanErrorLogdirectivewithina#container,errormessagesrelatingtothatvirtualhostwillbe#loggedhere.Ifyou*do*defineanerrorlogfilefora#container,thathost'serrorswillbeloggedthereandnothere.#ErrorLog"logs/error.log"##LogLevel:Controlthenumberofmessagesloggedtotheerror_log.#Possiblevaluesinclude:debug,info,notice,warn,error,crit,#alert,emerg.#LogLevelwarn##Thefollowingdirectivesdefinesomeformatnicknamesforusewith#aCustomLogdirective(seebelow).#LogFormat"%h%l%u%t\"%r\"%>s%b\"%{Referer}i\"\"%{User-Agent}i\""combinedLogFormat"%h%l%u%t\"%r\"%>s%b"common#Youneedtoenablemod_logio.ctouse%Iand%OLogFormat"%h%l%u%t\"%r\"%>s%b\"%{Referer}i\"\"%{User-Agent}i\"%I%O"combinedio##Thelocationandformatoftheaccesslogfile(CommonLogfileFormat).#Ifyoudonotdefineanyaccesslogfileswithina#container,theywillbeloggedhere.Contrariwise,ifyou*do*#defineper-accesslogfiles,transactionswillbe#loggedthereinand*not*inthisfile.#CustomLog"logs/access.log"common##Ifyoupreferalogfilewithaccess,agent,andrefererinformation#(CombinedLogfileFormat)youcanusethefollowingdirective.##CustomLog"logs/access.log"combined##Redirect:Allowsyoutotellclientsaboutdocumentsthatusedto#existinyourserver'snamespace,butdonotanymore.Theclient#willmakeanewrequestforthedocumentatitsnewlocation.#Example:#Redirectpermanent/foohttp://www.example.com/bar##Alias:Mapswebpathsintofilesystempathsandisusedto#accesscontentthatdoesnotliveundertheDocumentRoot.#Example:#Alias/webpath/full/filesystem/path##Ifyouincludeatrailing/on/webpaththentheserverwill#requireittobepresentintheURL.Youwillalsolikely#needtoprovideasectiontoallowaccessto#thefilesystempath.##ScriptAlias:Thiscontrolswhichdirectoriescontainserverscripts.#ScriptAliasesareessentiallythesameasAliases,exceptthat#documentsinthetargetdirectoryaretreatedasapplicationsand#runbytheserverwhenrequestedratherthanasdocumentssenttothe#client.Thesamerulesabouttrailing"/"applytoScriptAlias#directivesastoAlias.#ScriptAlias/cgi-bin/"D:/Apache2.2.19/httpd-2.2.19-win64/httpd-2.2-x64/cgi-bin/"##ScriptSock:Onthreadedservers,designatethepathtotheUNIX#socketusedtocommunicatewiththeCGIdaemonofmod_cgid.##Scriptsocklogs/cgisock##"D:/Apache2.2.19/httpd-2.2.19-win64/httpd-2.2-x64/cgi-bin"shouldbechangedtowhateveryourScriptAliased#CGIdirectoryexists,ifyouhavethatconfigured.#AllowOverrideNoneOptionsNoneOrderallow,denyAllowfromall##DefaultType:thedefaultMIMEtypetheserverwilluseforadocument#ifitcannototherwisedetermineone,suchasfromfilenameextensions.#IfyourservercontainsmostlytextorHTMLdocuments,"text/plain"is#agoodvalue.Ifmostofyourcontentisbinary,suchasapplications#orimages,youmaywanttouse"application/octet-stream"insteadto#keepbrowsersfromtryingtodisplaybinaryfilesasthoughtheyare#text.#DefaultTypetext/plain##TypesConfigpointstothefilecontainingthelistofmappingsfrom#filenameextensiontoMIME-type.#TypesConfigconf/mime.types##AddTypeallowsyoutoaddtooroverridetheMIMEconfiguration#filespecifiedinTypesConfigforspecificfiletypes.##AddTypeapplication/x-gzip.tgz##AddEncodingallowsyoutohavecertainbrowsersuncompress#informationonthefly.Note:Notallbrowserssupportthis.##AddEncodingx-compress.Z#AddEncodingx-gzip.gz.tgz##IftheAddEncodingdirectivesabovearecommented-out,thenyou#probablyshoulddefinethoseextensionstoindicatemediatypes:#AddTypeapplication/x-compress.ZAddTypeapplication/x-gzip.gz.tgz##AddHandlerallowsyoutomapcertainfileextensionsto"handlers":#actionsunrelatedtofiletype.Thesecanbeeitherbuiltintotheserver#oraddedwiththeActiondirective(seebelow)##TouseCGIscriptsoutsideofScriptAliaseddirectories:#(Youwillalsoneedtoadd"ExecCGI"tothe"Options"directive.)##AddHandlercgi-script.cgi#Fortypemaps(negotiatedresources):#AddHandlertype-mapvar##Filtersallowyoutoprocesscontentbeforeitissenttotheclient.##Toparse.shtmlfilesforserver-sideincludes(SSI):#(Youwillalsoneedtoadd"Includes"tothe"Options"directive.)##AddTypetext/html.shtml#AddOutputFilterINCLUDES.shtml##Themod_mime_magicmoduleallowstheservertousevarioushintsfromthe#contentsofthefileitselftodetermineitstype.TheMIMEMagicFile#directivetellsthemodulewherethehintdefinitionsarelocated.##MIMEMagicFileconf/magic##Customizableerrorresponsescomeinthreeflavors:#1)plaintext2)localredirects3)externalredirects##Someexamples:#ErrorDocument500"Theservermadeabooboo."#ErrorDocument404/missing.html#ErrorDocument404"/cgi-bin/missing_handler.pl"#ErrorDocument402http://www.example.com/subscription_info.html###EnableMMAPandEnableSendfile:Onsystemsthatsupportit,#memory-mappingorthesendfilesyscallisusedtodeliver#files.Thisusuallyimprovesserverperformance,butmust#beturnedoffwhenservingfromnetworked-mounted#filesystemsorifsupportforthesefunctionsisotherwise#brokenonyoursystem.##EnableMMAPoff#EnableSendfileoff#Supplementalconfiguration##Theconfigurationfilesintheconf/extra/directorycanbe#includedtoaddextrafeaturesortomodifythedefaultconfigurationof#theserver,oryoumaysimplycopytheircontentshereandchangeas#necessary.#Server-poolmanagement(MPMspecific)#Includeconf/extra/httpd-mpm.conf#Multi-languageerrormessages#Includeconf/extra/httpd-multilang-errordoc.conf#Fancydirectorylistings#Includeconf/extra/httpd-autoindex.conf#Languagesettings#Includeconf/extra/httpd-languages.conf#Userhomedirectories#Includeconf/extra/httpd-userdir.conf#Real-timeinfoonrequestsandconfiguration#Includeconf/extra/httpd-info.conf#Virtualhosts#Includeconf/extra/httpd-vhosts.conf#LocalaccesstotheApacheHTTPServerManual#Includeconf/extra/httpd-manual.conf#Distributedauthoringandversioning(WebDAV)#Includeconf/extra/httpd-dav.conf#Variousdefaultsettings#Includeconf/extra/httpd-default.conf#Secure(SSL/TLS)connections#Includeconf/extra/httpd-ssl.conf##Note:Thefollowingmustmustbepresenttosupport#startingwithoutSSLonplatformswithno/dev/randomequivalent#butastaticallycompiled-inmod_ssl.#SSLRandomSeedstartupbuiltinSSLRandomSeedconnectbuiltin
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 308 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信