Apache - "403 forbidden" message on any DIR below DocumentRoot
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Apache - "403 forbidden" message on any DIR below DocumentRoot
Updated: below is my original problem situation - I have now discovered that it is not just subdirectories that receive the "403 forbidden" message - attempting to access any file within the DocumentRoot, other than index.html, will produce this message.
**********************************
I'm attempting to setup Apache 2.2 on Fedora 5.
I have moved the DocumentRoot to a different directory /webdev and have one other directory below there /webdev/phonebills.
The main page works fine, and my small index.html file loads and displays my link to /phonebills/index.html, but when trying to access that directory, I get the "403 Forbidden message":
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/webdev"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/webdev">
#
# 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
I've been at this for days and just about at my wits end. I've searched stacks of webpages and previous posts here. I don't believe it is a permisions problem since /webdev and the subdir have the same owner and permissions.
yeah, I would think it'd be the permissions, I have a script set up to change the ownership and permissions of the files to what apache wants, and I would give you my exact script, but my computer is dead right now: http://www.linuxquestions.org/questi...d.php?t=453620
basically, just set the ownership to the user apache I think, I'm a bit rusty on this as it's been a while since I set up my own server. I think you should just set the permissions and ownership the same as you have you're index.html file set.
I really needed to start getting some actual work done, so I thought that until I resolved this problem, I would simply move my project files into /webdev - and I still recieve the same message when trying to access any files apart from index.html - so it's not just subdirectories that cant be accessed -- nothing can be accessed!!!
This situation has just gone from bad to horrifying
I'm posting a new thread with the updated problem situation as the title.
Apache - "403 forbidden" message on any file (or directory) other than index.html
I'm attempting to setup Apache 2.2 on Fedora 5.
To start with, I have moved the DocumentRoot to a different directory /webdev and have one other directory below there /webdev/phonebills.
The server is up and running, and my small index.html file loads and displays my links to other files and directories, but when trying to access anything other that {DocumentRoot}/index.html file, I get the "403 Forbidden message":
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/webdev"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/webdev">
#
# 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
I've been at this for days and just about at my wits end.
I posted a previous thread while I thought the problem was simply trying to access subdirectories below DocumentRoot, but have now discovered that no files/directories can be accessed other than index.html.
I've searched stacks of webpages and previous posts here. I don't believe it is a permisions problem since all the files in DocumentRoot have the same owner and permissions.
maybe apache does not have the permission to access the files (most probably /webdev/phonebills) its been crying foul about. locate the file/directories yourself within the filesystem and change their permissions so that apache or the user for whom apache is running can atleast read.
Permissions for all the files and subdiretories are the same - here they are...
/webdev
Quote:
drwxrwxr-x 4 apache apache 4096 Jun 11 18:42 webdev
/webdev/*
Quote:
-rw-rw-r-- 1 apache apache 127 Jun 11 18:41 index.html
-rw-rw-r-- 1 apache apache 423 Jun 6 20:42 PBlogin.html
-rw-rw-r-- 1 apache apache 114 Jun 6 20:30 PBmain.php
drwxrwxr-x 2 apache apache 4096 Jun 11 18:31 phonebills
Originally, I had the PB* files in /webdev/phonebills/, but I moved them back to /webdev/ thinking that it was jus a problem accessing the subdirectory ../phonebills/.
The only file listed above that can be accessed is index.html - any of the other files give the 403 forbidden message.
Here are the last few access attempts recorded in the log files:
The problem is that if you move stuff from other places into that directory, it will not have the right "context" for Apache to be allowed to access it. You can run "restorecon -R /webdev" to set the correct context. Turning off security is not the right solution.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.