LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Forbidden 403 error with my apache (https://www.linuxquestions.org/questions/linux-software-2/forbidden-403-error-with-my-apache-607104/)

entz 12-16-2007 08:19 AM

Forbidden 403 error with my apache
 
Greetings,

Well I'm facing yet another annoying problem which i can't understand why it's happening.

BACKGROUND:

downloaded and installed apache 2.2.6 from the sources
tar ...etc
./configure (default with no extra flags)
make
make install

then : $ APACHEDIR/apachectl start

now so far everything is working fine , and server handles request from the default DocumentRoot.

So Where is the Problem?
Well , shows up when i want to change the DocumentRoot to anything else than the default one , where i get a Forbidden 403 error.

so far I've checked all possible causes that i know of including the insertion of the directory which lifts the restriction from the new DocumentRoot
Code:

<Directory "/root/Desktop">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

and of course i've added (actually it's before the first)
Code:

DocumentRoot "/root/Desktop"
and yes I've also set the required access permissions for the directory

and another thing that i've noticed is that changing the DocumentRoot works only when it lies within the ServerRoot.

nonetheless , I've seen other config files on working servers where DocumentRoot lies outside the ServerRoot .
also noting that the default apache docs don't mention anything specifiec about this particular issue.

So basically I'm totally lost right now because i can't understand what I've left out in order to do such a trivial configuration.

P.S Yes I'm offering public access to MY OWN DESKTOP , OHH WEEE !!
but don't be so eager to look what's inside cuz the whole box is firewalled from the outside XD

Cheers

entz 12-16-2007 09:31 AM

PROBLEM SOLVED!

you can ignore this unless you want to learn from my experience .

well I found out that not only the document root directory has to have correct permissions but all directories above it as well !!

so if you doc is /your/root/doc

then having access restrictions on "your" would mess everything up even if
"root" and "doc" have 777 permission wildcards.

i think the best way to test whether the whole path is readable and accessible is to assume httpd process point of view by typing
$ su apache-user-account

that would log you in as the same user account that apache uses , then browse the Doc path and if you get blocked then you know where to fix :)

so that's all

Good Fight Good Night

jlinkels 12-17-2007 06:33 PM

That's why Linux is so safe :) (Although even Windows uses this hierarchical approach)

However, isn't it better to keep your web files somewhere below /var/www anyway? To avoid making errors and inadvertently opening something up you did not want to open?

You also have /home/yourname/public_html as a good place to store web files, and access them thru /localhost/~yourname. You have to enable this access in apache.conf though.

jlinkels


All times are GMT -5. The time now is 05:24 PM.