首頁 >php教程 >php手册 >ApacheReferenceManual4

ApacheReferenceManual4

WBOY
WBOY原創
2016-06-13 10:28:23790瀏覽

Syntax: ... Context: server config, virtual host Status: Core. Compatibility: Available in Apache 1.3 and later and are used to enclose a group of directives which will apply only to the named directory and sub-directories of that directory, the same as . However, it takes as an argument a regular expression. For example: would match directories in /www/ that consisted of three numbers. See Also: for a description of how regular expressions are mixed in with normal s. See also: How Directory, Location and Files sections work for an explanation of how these different sections are combined when a request is received -------------------------------------------------------------------------------- DocumentRoot directive Syntax: DocumentRoot directory-filename Default: DocumentRoot /usr/local/apache/htdocs Context: server config, virtual host Status: core This directive sets the directory from which httpd will serve files. Unless matched by a directive like Alias, the server appends the path from the requested URL to the document root to make the path to the document. Example: DocumentRoot /usr/web then an access to http://www.my.host.com/index.html refers to /usr/web/index.html. There appears to be a bug in mod_dir which causes problems when the DocumentRoot has a trailing slash (i.e., "DocumentRoot /usr/web/") so please avoid that. -------------------------------------------------------------------------------- ErrorDocument directive Syntax: ErrorDocument error-code document Context: server config, virtual host, directory, .htaccess Status: core Override: FileInfo Compatibility: The directory and .htaccess contexts are only available in Apache 1.1 and later. In the event of a problem or error, Apache can be configured to do one of four things, output a simple hardcoded error message output a customized message redirect to a local URL to handle the problem/error redirect to an external URL to handle the problem/error The first option is the default, while options 2-4 are configured using the ErrorDocument directive, which is followed by the HTTP response code and a message or URL. Messages in this context begin with a single quote ("), which does not form part of the message itself. Apache will sometimes offer additional information regarding the problem/error. URLs can begin with a slash (/) for local URLs, or be a full URL which the client can resolve. Examples: ErrorDocument 500 http://foo.example.com/cgi-bin/tester ErrorDocument 404 /cgi-bin/bad_urls.pl ErrorDocument 401 /subscription_info.html ErrorDocument 403 "Sorry cant allow you access today Note that when you specify an ErrorDocument that points to a remote URL (ie. anything with a method such as "http" in front of it) Apache will send a redirect to the client to tell it where to find the document, even if the document ends up being on the same server.. This has several implications, the most important being that if you use an "ErrorDocument 401" directive then it must refer to a local document. This results from the nature of the HTTP basic authentication scheme. See Also: documentation of customizable responses. -------------------------------------------------------------------------------- ErrorLog directive Syntax: ErrorLog filename|syslog[:facility] Default: ErrorLog logs/error_log (Unix) Default: ErrorLog logs/error.log (Windows and OS/2) Context: server config, virtual host Status: core The error log directive sets the name of the file to which the server will log any errors it encounters. If the filename does not begin with a slash (/) then it is assumed to be relative to the ServerRoot. If the filename begins with a pipe (|) then it is assumed to be a command to spawn to handle the error log. Apache 1.3 and above: Using syslog instead of a filename enables logging via syslogd(8) if the system supports it. The default is to use syslog facility local7, but you can override this by using the syslog:facility syntax where facility can be one of the names usually documented in syslog(1). SECURITY: See the security tips document for details on why your security could be compromised if the directory where logfiles are stored is writable by anyone other than the user that starts the server. See also: LogLevel -------------------------------------------------------------------------------- directive Syntax: ... Context: server config, virtual host, .htaccess Status: core Compatibility: only available in Apache 1.2 and above. The directive provides for access control by filename. It is comparable to the directive and directives. It should be matched with a directive. The directives given within this section will be applied to any object with a basename (last component of filename) matching the specified filename. sections are processed in the order they appear in the configuration file, after the sections and .htaccess files are read, but before sections. Note that can be nested inside sections to restrict the portion of the filesystem they apply to. The filename argument should include a filename, or a wild-card string, where `? matches any single character, and `* matches any sequences of characters. Extended regular expressions can also be used, with the addition of the ~ character. For example: would match most common Internet graphics formats. In Apache 1.3 and later, is preferred, however. Note that unlike and sections, sections can be used inside .htaccess files. This allows users to control access to their own files, at a file-by-file level. See also: How Directory, Location and Files sections work for an explanation of how these different sections are combined when a request is received ------------------------------------------------

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn