During connection, the server can only obtain the IP address of the client. If you want to obtain the host name of the client for logging and providing it to CGI programs, you need to use the HostnameLookups option, set it to On to enable the DNS lookup function. However, this causes the server to perform DNS queries for each customer request, increasing the system overhead.
During connection, the server can only obtain the IP address of the client. If you want to obtain the host name of the client for logging and providing it to CGI programs, you need to use the HostnameLookups option, set it to On to enable the DNS lookup function. However, this causes the server to perform DNS queries for each customer request, increasing the system overhead.
Normally,
ServerOnly the IP address of the client can be obtained.
Host Name for logging and providing it to CGI programs. You need to use this HostnameLookups option and set it to On to enable the DNS lookup function. However, this will make
ServerDNS queries are performed for each customer request, which increases system overhead and slows down the response. Therefore, the Off option is disabled by default. After the option is disabled,
ServerInstead of obtaining the host name of the client, you can only use the IP address to record the client.
ErrorLog/var/log/httpd-error.log
LogLevel warn
LogFormat "% h % l % u % t" % r "%> s % B" % {Referer} I "" % {User-Agent} "" combined
LogFormat "% h % l % u % t" % r "%> s % B" common
LogFormat "% {Referer} I-> % U" referer
LogFormat "% {User-agent} I" agent
# CustomLog/var/log/httpd-access.log common
# CustomLog/var/log/httpd-referer.log referer
# CustomLog/var/log/httpd-agent.log agent
CustomLog/var/log/httpd-access.log combined
The system log format is defined here.
ServerError Log. ErrorLog and LogLevel are used to define different error log files and their record content.
For system access logs, the CustomLog parameter is used by default to define the log location, and the combined parameter is used by default to specify to put all access logs in one file, however, you can also store different types of access logs in different log records by specifying different record types in CustomLog. Common indicates the access record of a single page request, and referer indicates the reference record of each page. The number of requests contained in a page can be seen, and agent indicates the type record of the client, obviously, you can comment out the existing configuration lines defined by combined, and use common, referer, and agent as the CustomLog parameters to specify log records for different types of logs.
Obviously, LogFormat is used to define different types of logs for recording. Here
The macro definition starting with % is used to record different contents.
If the files specified by these parameters use relative paths
Path.
ServerSignature On
In some cases, for example, when the requested webpage does not exist,
ServerThe error document will be generated,
By default, because the ServerSignature option is enabled, the last line of the error document will contain
ServerName, Apache version, and other information. Some administrators prefer not to display this information externally.
You can set this parameter to Off or Email. The last line will be replaced with the Email prompt for ServerAdmin.
Alias/icons/"/www/icons /"
Options Indexes MultiViews
AllowOverride None
Order allow, deny
Allow from all
The Alias parameter is used
ServerThe real location in the file system is directly mapped.
The document will be queried in DocumentRoot, but the path defined by Alias will be mapped directly to
Instead of querying under DocumentRoot. Therefore, Alias can be used to map some
Public file path. For example, the icons path of common icons is saved. In this way, in addition to using symbolic connections, directories outside the document root directory (DocumentRoot) can also be accessed by using Alias ing.
After defining the ing path, you must use the Directory statement to set access restrictions.
ScriptAlias/cgi-bin/"/www/cgi-bin /"
AllowOverride None
Options None
Order allow, deny
Allow from all
ScriptAlias is also used for URL path ing, but unlike Alias, ScriptAlias is used to map the path of CGI programs. All files in this path are defined as CGI programs, execute them to get results, instead
ServerDirectly return its content. By default, the CGI program uses the cgi-bin directory as the virtual path.
# Redirect old-URI new-URL
The Redirect parameter is used to override the URL. When the browser accesses
ServerWhen a nonexistent resource on,
ServerReturn a new URL to the browser, telling the browser to obtain resources from the URL. This is mainly used
ServerAfter changing the location of the document, and hope to use the old URL to access, to maintain compatibility with the previous URL.
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. Fig. 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.
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
When the URL of an HTTP request is a directory,
ServerReturns the index file in this directory. However, if a directory does not contain the default index file
ServerWhen the list of directory files is displayed, the list of files in the directory is displayed. In order to make the list of files understandable, it is not just a simple list, the preceding parameters are required.