Apache configuration prohibits access to directory 403

Source: Internet
Author: User
Tags php website

In the PHP website development, in order to let the website directory file and the program code security consideration, we must to some directories or the file Access Authority control, enhances the website the security, then how can we realize this function? Apache can then be configured to prevent Web sites from listing site content in the form of a directory.

When there is no configuration in Apache to prohibit directory access, when you access http://localhost will list the relevant directories and file lists, we can modify the Apache profile httpd.conf to prevent listing directory/file list, the following methods:

1, open the Apache configuration file "httpd.conf"

2, find the following parts

The code is as follows

<directory/>

Options Indexes

AllowOverride None

Order Allow,deny

Allow from all

</Directory>

Simply modify the options indexes to the options none.

Note: According to the PHP operating environment installation package is different, options Indexes may also be options Indexes followsymlinks, together with options none can be.

Save httpd.conf and restart Apache. If this does not work, continue to modify the following configuration:

  code is as follows &nbs P;

<directory "E:/web"

    #

    # Possible values for the Options directive are ' None ', ' all ',

    # or any comb Ination of:

    #   Indexes Includes followsymlinks symlinksifownermatch execcgi MultiViews

    #

    # Note that ' MultiViews ' must be named *explicitly*---' Options All "

    # doesn ' t give it to you.

    #

    # The Options directive is both complicated and important. 

    # http://httpd.apache.org/docs/2.2/mod/core.html#options

    # For more information.

    #

    options none

    #

    # allowoverride Controls what directives may 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 this server.

    #

    Order Allow,deny

    Allow from all

</directory>

As above: The red part of the inside, and then changed to the line.

3, save httpd.conf, and restart Apache, and then visit http://localhost, if there is no index.html or index.php these default files, will report Apache HTTP 403 prohibit access to error messages:

Forbidden

You don ' t have permission to access/on this server.

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.