Apache server configuration overview (7)

Source: Internet
Author: User
Article Title: Apache server configuration overview (7 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
If the IndexOptions FancyIndexing option is used, various icons can be referenced for different types of documents in the directory list generated by the server. The following AddIconByEncoding, AddIconByType, and AddIcon are used to determine which icons are used based on MIME encoding, type, and file suffix. If you cannot determine the icon used in the document, use the default icon defined by DefaultIcon.
  
Similarly, AddDescription can be used to add different descriptions for different types of documents. In addition, the server is still in the directory to query the files defined by ReadmeName and HeaderName (the extension of .html is automatically added. If no file is found, use the suffix of. txt for search). If these files are found, the contents of these files are first displayed before the file list to make the normal directory list more understandable.
  
IndexIgnore allows the server to ignore the corresponding files when listing the files. The file name is defined in mode configuration.
  
AddEncoding x-compress Z
  
AddEncoding x-gzip gz
  
AddEncoding is used to tell the compressed MIME type, so that the browser can perform the decompression operation.
  
AddLanguage en. en
  
AddLanguage fr. fr
  
AddLanguage de. de
  
AddLanguage da. da
  
AddLanguage el. el
  
AddLanguage it. it
  
LanguagePriority en fr de
  
An HTML document can be used to prepare multiple languages at the same time. For example, a file1.html document can be used to prepare different versions such as file1.html.en1_file1.html. fr. Each Language suffix must be defined using AddLanguage. In this way, the server can negotiate with the browser to send different language versions for customers in different countries. The Semantic agepriority defines the priority levels of different languages, so that when the browser does not have special requirements, the requests for file1.html are returned in different languages in sequence. There are not many practical applications of this internationalization capability.
  
# AddType application/x-httpd-php. phtml
  
# AddType application/x-httpd-php-source. phps
  
The AddType parameter can specify the MIME type for a file with a specific suffix. The settings here will overwrite the settings in mime. types.
  
# AddHandler cgi-script. cgi
  
AddHandler is used to specify a non-static processing type. It is used to define a document as a non-static file type and needs to be processed before returning the processing result to the browser. For example, if the setting in the above comment is to set the file ending with. cgi to the cgi-script type, the server will start this CGI program for processing. If you need to execute the CGI program outside the path defined by AliasScript, you need to use this parameter for setting. Then, the file ending with. cgi will be executed as a CGI program.
  
The CGI program must be allowed in the configuration file,. htaccess in this directory, and. htaccess in its parent directory. This must be set through the Options ExecCGI parameter.
  
# AddType text/html. shtml
  
# AddHandler server-parsed. shtml
  
Another type of dynamic processing is server-parsed. The server analyzes the tags in the webpage in advance and changes the tags to the correct HTML tags. Because server-parsed needs to process text/html documents, the corresponding .shtml must be of the text/html type.
  
However, to support SSI, you must first in the configuration file (or. in htaccess), the Options using des allows the documents in this directory to be of the SSI type, or use Options using desnoexec to execute a common SSI flag, but do not execute external programs referenced in it.
  
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 documents (documents suffixed with .html ), if the file property has the execution bit "x", the server considers it as a server analysis document and needs to be processed by the server. We recommend that you use AddHandler to set the XBitBack to Off, because XBitBack can be used to perform additional checks on all HTML documents, reducing efficiency.
  
# AddHandler send-as-is asis
  
# AddHandler imap-file map
  
# AddHandler type-map var
  
The AddHandler mentioned 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 Apache provides limited processing functions internally, you can use Action to define external programs as the types of dynamic documents that can be processed for the server. These external programs are the same as Standard CGI programs, after the input data is processed, the results of different MIME types are output. For example, to define an operation that executes wri2txt for the special suffix wri and then returns the result, you can use:
  
Action windows-writer/bin/wri2txt
  
AddHandler windows-writer wri
  
Furthermore, you can directly use Action to define a pre-processing operation for a MIME type. This requires the Action parameter setting method in the first format in the example. In this way, no additional AddHandler is required to associate the processing operation with the file suffix. Instead, Action is used to directly process MIME-type files. However, if the document suffix does not have a formal MIME type, you must first define a MIME type.
  
# MetaDir. web
  
# MetaSuffix. meta
  
Meta Information is pre-sent to the customer's browser before the document is sent to the customer. Therefore, the browser can access the 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. To add additional information, you need to use MetaDir to define the directory where Meta data is stored, metaS uffix is used to specify the file suffix that contains Meta data.
  
# ErrorDocument 500 "The server made a boo.
  
# ErrorDocument 404/missing.html
  
# ErrorDocument 404/cgi-bin/missing_handler.pl
  
# ErrorDocument 402
  
Http://some.other _ server.com/subscription_info.html
  
If the requested webpage does not exist or has no access permission, the server will generate an error code and respond to the webpage marked incorrectly by the client browser.
  
ErrorDocument is used to set the content in the client browser when an error occurs. The first parameter of ErrorDocument is the error serial number, and the second parameter is the response data, which can be simple text, local Web pages, local CGI programs, and web pages on remote hosts.
  
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 & quot; JDK/1.0 & quot; force-response-1.0
  
The BrowserMatch command is used to set special parameters for specific client programs 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.