Home  >  Article  >  Backend Development  >  Conversion of APACHE configuration file httpd.conf to 3_PHP tutorial

Conversion of APACHE configuration file httpd.conf to 3_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:28:01844browse

IndexOptions FancyIndexing AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip AddIconByType (TXT,/icons/text.gif) text/* AddIconByType (IMG,/icons/image2.gif) image/* AddIconByType (SND ,/icons/sound2.gif) audio/* AddIconByType (VID,/icons/movie.gif) video/* AddIcon /icons/binary.gif .bin .exe AddIcon /icons/binhex.gif .hqx AddIcon /icons/tar .gif .tar AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip AddIcon /icons/a.gif .ps . ai .eps AddIcon /icons/layout.gif .html .shtml .htm .pdf AddIcon /icons/text.gif .txt AddIcon /icons/c.gif .c AddIcon /icons/p.gif .pl .py AddIcon /icons /f.gif .for AddIcon /icons/dvi.gif .dvi AddIcon /icons/uuencoded.gif .uu AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl AddIcon /icons/tex.gif .tex AddIcon /icons/bomb.gif core AddIcon /icons/back.gif .. AddIcon /icons/hand.right.gif README AddIcon /icons/folder.gif ^^DIRECTORY^^ AddIcon /icons/blank.gif ^^ BLANKICON^^ DefaultIcon /icons/unknown.gif #AddDescription "GZIP compressed document" .gz #AddDescription "tar archive" .tar #AddDescription "GZIP compressed tar archive" .tgz ReadmeName README HeaderName HEADER IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t 当一个HTTP请求的URL为一个目录的时候,服务器返回这个目录中的索引文件。但如果一个目录中不存在缺省的索引文件,并且该服务器又许可显示目录文件列表的时候,就会显示出这个目录中的文件列表,为了使得这个文件列表能具有可理解性,而不仅仅是一个简单的列表,就需要前面的这些设置参数。 如果使用了Index Options Fancy Indexing文件使用哪种图标,则使用 下面的 AddIconByEncoding、AddIconByType以及AddIcon来定义,分别依据MIME 的编码、类型以及文件的后缀来判断使用何种图标。如果不能确定文档使用的图标,就使用 DefaultIcon服务器还在目录下,查询使用ReadmeName和HeaderName定义的文件(自动加上 . html后缀,如果没有发现,再使用.txt后缀进行搜索),如果发现了这些文件, 就在文件列表之前首先显示这些文件的内容,以使得普通目录列表具备更大的可 理解性。   IndexIgnore让服务器在列出文件列表时忽略相应的文件, 这里使用模式配 置的方式定义文件名。 AddEncoding x-compress Z AddEncoding x-gzip gz  AddEncoding用于告诉一些使用压缩的MIME类型,这样可以让浏览器进行解压缩操作。 AddLanguage en .en AddLanguage fr .fr AddLanguage de .de AddLanguage da .da AddLanguage el .el AddLanguage it .it LanguagePriority en fr de   一个HTML文档可以同时具备多个语言的版本,如对于file1.html文档可以具 备file1.html.en、file1.html.fr 等不同的版本,每个语言后缀必须使用 AddLanguage进行定义。这样服务器可以针对不同国家的客户,通过与浏览器进行协商,发送不同的语言版本。而LanguagePriority 定义不同语言的优先级,以便在浏览器没有特殊要求时,按照顺序使用不同的语言版本回应对file1.html 的请求。 这个国际化的能力实际的应用并不多。 #AddType application/x -httpd-php .phtml #AddType application/x-httpd-php-source .phps  AddType参数可以为特定后缀的文件指定MIME类型,这里的设置将覆盖 mime.types中的设置。   #AddHandler cgi-script .cgi AddHandler是用于指定非静态的处理类型,用于定义文档为一个非静态的文 档类型,需要进行处理,再向浏览器返回处理结果。例如上面注释中的设置是将以.cgi结尾的文件设置为cgi-script类型,那么服务器将启动这个CGI程序以进行处理。如果需要在前面AliasScript定义的路径之外执行CGI程序,就需要使用这个参数进行设置,此后以.cgi结尾的文件将被当作CGI程序执行。   在配置文件、这个目录中的.htaccess以及其上级目录的.htaccess中必须允许执行CGI程序,这需要通过Options ExecCGI参数设定。 #AddType text/html .shtml #AddHandler server-parsed .shtml   另外一种动态进行处理的类型为server-parsed,由服务器自身预先分析网页内的标记,将标记更改为正确的HTML标识。由于server-parsed需要对text/html 类型的文档进行处理,因此首先定义了对应的.shtml为text/html类型。  然而要支持SSI,还要首先要在配置文件(或.htaccess)中使用Options IncludesOptions IncludesNOExec让执行普通的SSI标志,但不执行其中引用的外部程序。Another way to specify the server-parsed type is to use the XBitBack setting option. If XBitHack is set to On, the server will check all text/html type documents (including documents with the .html suffix). If it is found that the file attribute has the execution bit " x", the server considers it to be a server analysis document and needs to be processed by the server. It is recommended to use AddHandler for settings and set XBitBack to Off, because using XBitBack will perform additional checks on all HTML documents, reducing efficiency. #AddHandler send-as-is asis #AddHandler imap-file map #AddHandler type-map var The AddHandler commented above is used to support the asis, map and var processing capabilities of the Apache server. # Action media/type /cgi-script/location # Action handler-name /cgi-script/location Because the processing functions provided internally by Apache are limited, you can use Action to define external programs for the server as dynamic document types that can be processed. These external The program is the same as the standard CGI program. It processes the input data and then outputs the results of different MIME types. For example, to define an operation that first executes wri2txt to process the special suffix wri and then returns the result, you can use: Action windows-writer /bin/wri2txt AddHandler windows-writer wri Further, you can directly use Action to define a certain MIME The type is processed in advance, which requires the Action parameter setting method in the first format in the example. This setting method no longer requires an additional AddHandler to associate the processing operation with the file suffix, but uses Action to directly process MIME type files. But if the document suffix does not have a formal MIME type, you need to define a MIME type first. #MetaDir .web #MetaSuffix .meta Meta information is sent to the client's browser before the document is sent to the client. Therefore, the browser can access this Meta information through the HEAD request without actually returning all the document data through GET. The server usually sends some standard HTTP header information to the browser. If you want to add additional information, you need to use MetaDir to define the directory where the Meta data is stored, and MetaSuffix is ​​used to specify the suffix of the file containing Meta data. #ErrorDocument 500 "The server made a boo boo. #ErrorDocument 404 /missing.html #ErrorDocument 404 /cgi-bin/missing_handler.pl #ErrorDocument 402 http://some.other_server.com/subscription_info.html   If the web page requested by the customer When a situation such as non-existence or lack of access rights occurs, the server will generate an error code and will also respond to the client's browser with a web page identifying the error. ErrorDocument is used to set the content that should be responded to by the client's browser when an error occurs. The first parameter of ErrorDocument is the error sequence number, and the second parameter is the response data, which can be simple text, local web page, local CGI program, and web page on the remote host. BrowserMatch "Mozilla/2" nokeepalive BrowserMatch "MSIE. 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0 BrowserMatch "RealPlayer 4.0" force-response-1.0 BrowserMatch "Java/1.0" force-response-1.0 BrowserMatch "JDK/1.0" force-response-1.0 The BrowserMatch command is specific The client program sets special parameters to ensure compatibility with older browsers and support new features of new browsers. # # SetHandler server-status # Order deny,allow # Deny from all # Allow from .your_domain.com. # # # SetHandler server-info # Order deny,allow # Deny from all # Allow from .your_domain.com # # # Deny from all # ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi is used to set access control The settings are mainly for directories and files, but you can also set access control for different URLs, so you don't have to worry about whether ScriptAlias ​​and Alias ​​set the path outside the controlled directory. The statement that controls the URL is the Location statement, which not only protects files and CGI on the server, but also protects special function URLs that cannot find the corresponding files but are provided by the server itself. http://servername/server-status is used to report the current status of the Apache server, and http://servername/server-info is used to report the statistical information of the Apache server. Related settings include the ExtendedStatus parameter, which allows the server to output a more detailed report. # #ProxyRequests On # # # Order deny,allow # Deny from all # Allow from .your_domain.com # #ProxyVia On #CacheRoot "/www/proxy" #CacheSize 5 #CacheGcInterval 4 #CacheMaxExpire 24 #CacheLastModifiedFactor 0.1 #CacheDefaultExpire 1 # NoCache a_domain.com another_domain.edu joes.garage_sale.com # The Apache server itself has the proxy function, but this requires the mod_proxy module to be loaded. This can be determined using the IfModule statement. If the mod_proxy module exists, use ProxyRequests to turn on proxy support. The following Directory is used to set access permission settings to the Proxy function, as well as to set various parameter settings for buffering. Virtual Host #NameVirtualHost 12.34.56.78:80 #NameVirtualHost 12.34.56.78 # # ServerAdmin webmaster@host.some_domain.com # DocumentRoot /www/docs/host.some_domain.com # ServerName host.som

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/531827.htmlTechArticleIndexOptions FancyIndexing AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip AddIconByType (TXT,/icons/text.gif) text/* AddIconByType (IMG,/icons/image2.gif) image/*...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn