2007-04-03

if Apache 2 can't display accessible pages

Forrest Sheng Bao
<http://forrest.bao.googlepages.com>

If you have set the privilege to some files and directories to be accessible on Linux, but Apache 2 said

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

"
That is maybe 'cause you haven't set the privilege on Apache 2 configuration file.
You need to create a <Document "/path/to/your/file"> and </Document> tag pair.

For example, I have set
DocumentRoot "/forrest/work/bme/www"

If I don't set a <Document "/path/to/your/file"> and </Document> tag pair, I will get above warning.
So I insert following into Apache 2 configuration files.

<Directory "/forrest/work/bme/www">
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Then, pages can be displayed. OK. Done.

Here is the example tag pair with default setting in Apache2 configuration files.
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/usr/local/apache2/htdocs">

#
# Possible values for the Options directive are "None", "All",
# or any combination 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. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#?
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be 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>

No comments: