LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I Fixed Apache 403 Forbidden Problem, but how? (https://www.linuxquestions.org/questions/linux-newbie-8/i-fixed-apache-403-forbidden-problem-but-how-138649/)

shosterman 01-25-2004 10:23 PM

I Fixed Apache 403 Forbidden Problem, but how?
 
For the past few days I've been trying to allow visitors to browse the directories on my server (Apache 2.0.48), for example a /pictures directory. I kept receiving the 403 Forbidden problem that seemed so common on these forums. I finally fixed the problem, but I still don't really know what I did to fix it. Let me start with what I did to get there.

I tried all the tips I could find on this site and others such as doing "chmod 755" on the /srv/www/htdocs/pictures directory and in fact I think I ended up doing it on every directory, but that didn't work.

I also tried adding a few lines in the .conf file that read...
Code:

<Directory "/srv/www/htdocs/pictures">
  Options Indexes FollowSymLinks
  Order allow,deny
  Allow from all
</Directory>

That didn't work either, still gave me the 403 Forbidden error. I should mention that I could access a file based on a direct link, but not general directory browsing.

Next I tried using a virtual host as...
Code:

<VirtualHost shosterman.dyndns.org>
  DocumentRoot "/srv/www/htdocs/"
  Options Indexes
</VirtualHost>

That didn't work either, but then again I'm not exactly sure what a virtual host does. :)

I don't have an .htaccess file so I skipped most of the how-to's that involved that.

These settings were default in there already and I spent several hours toying around with different configurations, but never succeeded.
Code:

<Directory "/srv/www/htdocs">
  Options Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

So finally, what I did to get it working was I added this code in...
Code:

<Location />
  Options Indexes FollowSymLinks ExecCGI
  AllowOverride None
</Location>

All this time I have never seen the word Location used, I only tried it after a friend suggested changing the word Directory to Location. He was as surprised as I was that it worked because he said these were supposed to be interchangeable.

After checking the apache website for Location, I found this explanation, but it doesn't help me understand why it worked and Directory did not.

Anyway, I was looking for some help why making that switch solved my problem. More importantly though, I'm hoping this might help out others stuck with the same problem.

Stephen

fragglehorn 01-26-2004 03:07 AM

That is bizarre, I don't now why location would work and not directoy. By any chance, did you edit anything following IndexOptions?

shosterman 01-26-2004 10:33 AM

I don't think so, if I don't know what it is or does, I try not to mess with it. :) That line reads..
Code:

IndexOptions FancyIndexing VersionSort
Is there something specific you were looking for?

I'm going to play around with Location settings like I was trying to do before with Directory and see if I can get some of the things working that I couldn't. Specifically password protected folders and user folders.


All times are GMT -5. The time now is 10:56 PM.