Apache's security configuration settings prohibit directory access method

This article describes how to configure Apache prohibit directory access, which is a common one apache security configuration is necessary, need friends can refer to the following

In PHP web development in order to make the site directory and file security program code, we have to access to certain directories or files of control, to improve the security of the site, then how do we achieve this function? This time can be configured to disable the Apache Web site lists web content in the form of a directory.

Prohibition is not configured in Apache Directory Access, when you visit http: // localhost lists when a list of files and directories related, we can achieve a ban list directory / file list by modifying the Apache configuration file httpd.conf, method as follows:

1. Open the apache configuration file "httpd.conf"

2, locate the following section

copy the code follows the code: <Directory />
Options Indexes
the AllowOverride None
the Order the allow, the deny
the Allow from All
</ Directory>
simply Options Indexes can be modified to Options None.

Note: Depending on the PHP runtime environment installation package, Options Indexes is also possible that Options Indexes FollowSymLinkshttp: //www.bbqmw.net/qm_bbqmbd/ baby naming book, instead Options None can be together.

Save httpd.conf, restart apache. At this time, if not, continue to modify the following configuration:
copy the code code is as follows:
<Directory "E: / Web">
    #
    # Possible values for the Options The Directive are "None", "All",
    # or the any Combination of:
    # the Indexes FollowSymLinks SymLinksIfOwnerMatch ExecCGI MultiViews Includes
    #
    # Note that "MultiViews" the MUST BE Explicitly named * * --- "Options All"
    # does not give IT to you.
    #
    # Options at The Directive Complicated and both-IS Important Please See.
    # HTTP: //httpd.apache.org/docs/2.2/mod/core.html#options
    # for More Information.




    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None
    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
</Directory>

Above: The red part of which, together with change overnight on the line.

3, save httpd.conf, and restart Apache can, then re-visit http: when // localhost, if no index.html or index.php the default file, it will report apache http 403 Forbidden error message:
copy the code code is as follows: Forbidden
by You do not have have permission to Access / ON the this Server.

Guess you like

Origin www.cnblogs.com/murongyuling/p/10979023.html