Apache server configuration overview (6)

Source: Internet
Author: User
Here we can see another statement, Limit, which is used to set access control for specific request methods, you can use GET, POST, and other server-supported request methods as Limit parameters to set access restrictions for different request methods. Generally, you can open three Request methods: GET, POST, and HEAD, and shield other request methods to add Apache

Here we can see another statement, Limit, which is used to set access control for specific request methods, you can use GET, POST, and other server-supported request methods as Limit parameters to set access restrictions for different request methods. Generally, you can open the GET, POST, and HEAD request methods, and shield other request methods to increase security. In the Limit statement, you can use the Order, Allow, Deny, Allow, and Deny methods to restrict domain names and IP addresses, except that the domain names are matched forward and backward, the IP address is matched from the front to the back.


DirectoryIndex index.html

In many cases, the document name is not specified in the URL, but a directory name is provided. The Apache server will automatically return the files defined by DirectoryIndex in this directory. of course, multiple file names can be specified, and the system will search in this directory in sequence. If all the files specified by DirectoryIndex do not exist, the Apache server can generate a list of all the files in this directory based on the system settings. In this case, the Indexes option (Options Indexes) in the access control option of the directory must be enabled so that the server can generate a directory list. otherwise, Apache rejects access.


AccessFileName. htaccess

AccessFileName defines the name of the access control file under each directory. the default value is. htaccess. you can change this file to change the access control restrictions of different directories.


Order allow, deny

Deny from all

In addition to directory access control, you can also set access control based on files.

Is the task of the File statement. When using the File statement, no matter which Directory the File is in, the corresponding access control must be accepted as long as the name matches. This statement is important to system security. for example, in the above example, all users will be blocked from accessing the. htaccess file, so that key security information in. htaccess will not be obtained by the customer.


# CacheNegotiatedDocs

By default, if the proxy server and Apache server negotiate whether to cache their web pages

In a negative response, you do not want your webpage to be cached by the proxy server. However, this method cannot effectively take advantage of the proxy server. Therefore, you can set the CacheNegotiatieDocs option to enable the proxy server to cache webpages. However, even if this option is not set, some proxy servers (or by adjusting the settings) can cache webpages.


UseCanonicalName On

Enabling this UseCanonicalName is the standard practice of the Web server, because most of the requests sent by the client are referenced by the server, so that the server can use the ServerName and Port options to build a complete URL, and respond to the customer so that the browser can get a standard URL. If this parameter is set to Off, Apache will obtain the server name and Port value from the customer request (this information will be available in requests of customers that support HTTP 1.1 ), rebuild the URL.


TypesConfig/usr/local/apache/etc/mime. types

TypeConfig is used to set the file name for storing data of different MIME types. in Linux, it is set to/usr/local/apache/etc/mime. types by default.


DefaultType text/plain

If the Web server cannot determine the default type of a document, which usually indicates that the document uses a non-standard suffix, the server uses the MIME type defined by DefaultType to send the document to the client browser. The setting here is text/plain. The problem with this setting is that if the server cannot determine the MIME of the document, this document is a binary document in most cases, however, if you use the text/plain format to send it back, the browser will open it internally without prompting to save it. Therefore, we recommend that you change this setting

Application/octet-stream, so that the browser will prompt the user to save.


MIMEMagicFile/usr/local/apache/etc/magic

In addition to determining the MIME type of a file based on the file suffix, Apache can further split

Analyzes the characteristics of a file to determine the actual MIME type of the file. This function is implemented by the mod_mime_magic module. it requires a file that records various MIME-type features for analysis and judgment. The above setting is a condition statement. if this module is loaded, you must specify the location of the magic mark file.

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.