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": **************************************************************** You don't have permission to access /phonebills/index.html on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request. **************************************************************** Below is a portion of my httpd.conf file... Quote:
Any suggestions as to what might be wrong here? |
What about the permissions of the files in /webdev and /webdev/phonebills/ ?
For comparison, here are some example file and directory permissions from DocumentRoot and a subdirectory on my old Mandrake 9.1 server: DocumentRoot /var/www/html Code:
drwxr-xr-x root root /var/www/html/ |
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 think the permisions are ok - below is a list of the permisions for all related directories and files:
/ ... .... drwxrwxr-x 3 apache apache 4096 Jun 10 10:16 webdev /webdev/ -rw-rw-r-- 1 apache apache 120 Jun 10 10:05 index.html drwxrwxr-x 2 apache apache 4096 Jun 10 10:30 phonebills /webdev/phonebills/ -rw-rw-r-- 1 apache apache 423 Jun 6 20:42 index.html -rw-rw-r-- 1 apache apache 114 Jun 6 20:30 PBmain.php As you can see, permissions for /webdev and /webdev/phonebills are the same, as are all the files in each directory. I just don't get it :confused: |
Problem situation changed...
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 :cry: I'm posting a new thread with the updated problem situation as the title. Thanks to all who have replied so far. |
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": **************************************************************** You don't have permission to access {selected path and file} on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request. **************************************************************** Below is a portion of my httpd.conf file... Quote:
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. Any suggestions as to what might be wrong here? |
It may not make any difference but I notice the DocumentRoot line in my httpd.conf is not enclosed in quotes.
|
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.
|
Have a look at
/var/log/httpd/access_log /var/log/httpd/error_log /var/log/messages for some clues. Are you using vhost.conf? |
Permissions for all the files and subdiretories are the same - here they are...
/webdev Quote:
Quote:
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: access.log Quote:
Quote:
Any other suggestions? |
Also here are the last few entries in /var/messages
Quote:
|
Fixed it.
The problem was with SElinux. Running the command system-config-securitylevel and ticking all the checkboxes for HTTPD has solved the problem. Thank you to everyone who has tried to help with this. |
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.
|
All times are GMT -5. The time now is 03:55 PM. |