Home > Article > Backend Development > Apache server configuration guide (6)_PHP tutorial
Here you can see another statement Limit. The Limit statement is used to set access control for specific request methods. You can use GET, POST and other request methods supported by the server as Limit parameters to set the limit for different requests. Access restrictions for request methods. Generally, you can enable three request methods: GET, POST, and HEAD, and block other request methods to increase security. In the Limit statement, you can use Order, Allow, and Deny. In Allow and Deny, you can use matching methods to limit domain names and IPs. However, domain names are matched from back to front, and IP addresses are matched from front to back.
DirectoryIndex index.html
In many cases, the name of the document is not specified in the URL, but only a directory name is given. Then the Apache server will automatically return the files defined by DirectoryIndex in this directory. Of course, you can specify multiple file names, and the system will search sequentially in this directory. When all files specified by DirectoryIndex do not exist, the Apache server can generate a list of all files in this directory based on system settings to provide user selection. At this time, the Indexes option (Options Indexes) in the access control options of the directory must be turned on so that the server can generate the directory list, otherwise Apache will deny access.
AccessFileName .htaccess
AccessFileName defines the file name of the access control file in each directory. The default is .htaccess. You can change the access control restrictions of different directories by changing this file.
Order allow,deny
Deny from all
In addition to access control for directories, access control can also be set based on files. This
is the task of the File statement . Using the File statement, no matter which directory the file is in, as long as the name matches, it must accept the corresponding access control. This statement is important for system security. For example, the above example will block all users from accessing the .htaccess file, thus preventing the key security information in .htaccess from being obtained by customers.
#CacheNegotiatedDocs
By default, if the proxy server negotiates with the Apache server whether to cache its web pages, Apache will give a negative answer
and does not want its web pages to be cached by the proxy server. However, this cannot effectively take advantage of the proxy server, so you can set the CacheNegotiatieDocs option so that the proxy server can cache web pages. However, even if this option is not set, some proxy servers (or by adjusting settings) can cache web pages.
UseCanonicalName On
It is a standard practice for web servers to turn on this UseCanonicalName, because most of the requests sent by the client are references to this server, so that the server can use the settings of the ServerName and Port options. Construct a complete URL and respond to the client so that the browser can obtain the canonical URL. If this parameter is set to Off, Apache will reconstruct the URL using the server name and port value obtained from the client request (this information will be included in the request from clients that support HTTP 1.1).