In the development of PHP Web site, based on the security of Web server and PHP website program code, we need to control the relevant directory or file access permissions to prevent the occurrence of unexpected situations, then how do we implement this function? We can use Apache to disable Directory access (no list of directories or files listed), disable or allow IP and domain names to access the directory.
Configuring prohibit Directory Access in Apache, which is a way to disable the list of directories/files listed
When accessing the Site directory, Apache is configured to list directories/files by default, that is, when you access http://localhost, a list of related directories and files is listed, and we can modify the Apache configuration file httpd.conf to implement a list of prohibited directories/files. Here's how:
1, open the Apache configuration file httpd.conf
2. Find
<directory/>
Options Indexes
allowoverride None
Order Allow,deny
Allow from all
</Directory>
Only need to modify options Indexes for options None, note: Depending on the PHP operating environment installation package, options Indexes may also be options Indexes followsymlinks, Change to Options none.
Also note: If you re-set the DocumentRoot, for example: the change of place is different.
<directory"D:/apache2/webpage">
#
# Possible values for the Options directive is "None", "all",
# or any combination of:
# Indexes includes followsymlinks symlinksifownermatch execcgi multiviews
#
# Note that "MultiViews" must is named *explicitly*---"Options all"
# doesn ' t give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.0/mod/core.html#options
# for more information.
#
# Options Indexes followsymlinks
Options FollowSymLinks
The role of #Indexes is to display the directory structure when there are no index.html files in the directory, and to remove Indexes,apache the list of directories is not displayed.
# AllowOverride Controls What directives is placed in. htaccess files.
# It can be ' all ', ' None ', or any combination of the keywords:
# Options FileInfo authconfig Limit
#
AllowOverride None
#
# Controls who can get stuff from the this server.
#
Order Allow,deny
Allow from all
</Directory>
3, save httpd.conf, and restart Apache can, at this time to visit http://localhost, reported Apache HTTP 403 Forbidden Access error message
Forbidden
You don't have permission to access/on the this server.
Another approach is to address directory issues, but not the underlying problem, in the specified Web directory: http://jwc.jxatei.net:8080/"index.html, index.php".
At this point, by configuring the Apache server, we can implement a ban on Directory access (listing directories or file lists), which is an essential way to improve and optimize the security of your Web server.
Disable access to the Apache directory