FAQ
Hello,

I am having some difficulties configuring my Apache server.

Goal (pretty standard):
Then the file is not specified in the request, load index.html in
that directory. If there is no index.html, do _not_ allow directory
browsing.

Problem:
I am getting 403 Forbidden and this error in my error_log:

Directory index forbidden by rule: /www/htdocs


I am trying to set this up for a virtual host.
I have this in my the virtual host section:

DocumentRoot /www/htdocs
DirectoryIndex index.html
<Directory "/www/htdocs">
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex index.html
</Directory>


I can get rid of my error by adding 'Indexes' to the Options list.
However, that then shows the directory listing (and index.html in it),
instead of automatically loading index.html

I feel like a newbie, although I've been using Apache and NCSA httpd
for close to 10 years now.

I have Apache 1.3.29 on Linux.

Thank you,
Otis
P.S.

If it matters, the main part of the httpd.conf also contains this:

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

as well as:

<Directory "/usr/local/apache/htdocs">
Options Indexes FollowSymLinks MultiViews
...
</Directory>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Search Discussions

  • Joshua Slive at Apr 1, 2004 at 3:52 pm

    On Thu, 1 Apr 2004 ogjunk-h@yahoo.com wrote:
    Goal (pretty standard):
    Then the file is not specified in the request, load index.html in
    that directory. If there is no index.html, do _not_ allow directory
    browsing.

    Problem:
    I am getting 403 Forbidden and this error in my error_log:

    Directory index forbidden by rule: /www/htdocs
    DocumentRoot /www/htdocs
    DirectoryIndex index.html
    <Directory "/www/htdocs">
    Options FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    DirectoryIndex index.html
    </Directory>
    If you request the file directly (http://yourhost.example.com/index.html)
    does it work?

    Are you sure the file is named *exactly* index.html, all lowercase, etc?

    Are there any other DirectoryIndex directives (for example, in an
    .htaccess file) that could be overriding this one?

    Joshua.

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org
  • Ogjunk-h at Apr 1, 2004 at 4:04 pm
    Hello,

    Answers inlined:

    --- Joshua Slive wrote:
    On Thu, 1 Apr 2004 ogjunk-h@yahoo.com wrote:
    Goal (pretty standard):
    Then the file is not specified in the request, load index.html in
    that directory. If there is no index.html, do _not_ allow directory
    browsing.

    Problem:
    I am getting 403 Forbidden and this error in my error_log:

    Directory index forbidden by rule: /www/htdocs
    DocumentRoot /www/htdocs
    DirectoryIndex index.html
    <Directory "/www/htdocs">
    Options FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    DirectoryIndex index.html
    </Directory>
    If you request the file directly
    (http://yourhost.example.com/index.html)
    does it work?
    Yes, that does work.
    Are you sure the file is named *exactly* index.html, all lowercase,
    etc?
    Yes:
    $ ls -al /www/htdocs/index.html
    -rw-r--r-- 1 otis otis 12 Mar 31 12:45
    /www/htdocs/index.html

    Permissions:

    /www directory:
    drwxrwsr-x 5 otis otis 4096 Mar 27 00:43 www

    /www/htdocs directory:
    drwxr-xr-x 2 otis otis 4096 Mar 31 12:45 htdocs

    /www/htdocs/index.html file:
    -rw-r--r-- 1 otis otis 12 Mar 31 12:45 index.html
    Are there any other DirectoryIndex directives (for example, in an
    .htaccess file) that could be overriding this one?
    I don't have any .htaccess files (this is a brand new server).

    I have only this in the main part (outside virtual host section) of the
    httpd.conf:

    <IfModule mod_dir.c>
    DirectoryIndex index.html index.jsp
    </IfModule>

    Thanks,
    Otis


    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org
  • Joshua Slive at Apr 1, 2004 at 6:11 pm

    On Thu, 1 Apr 2004 ogjunk-h@yahoo.com wrote:
    If you request the file directly
    (http://yourhost.example.com/index.html)
    does it work?
    Yes, that does work.
    Are you sure the file is named *exactly* index.html, all lowercase,
    etc?
    Yes:
    Well, we have exhausted all the easy tests. Since I've never heard anyone
    with this particular problem before (DirectoryIndex being ignored), it is
    likely that there is some silly config thing going wrong. Can you try
    reverting to the default config files that came with apache, and making
    only the very basic changes that are necessary to serve files on your
    system. (ie, don't setup virtual hosts) Then see if that works.

    Another alternative is to post your httpd.conf on the web someplace so
    people can look and see if there is anything that may be causing
    conflicts.

    Joshua.

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org
  • Kovacs Baldvin at Apr 1, 2004 at 6:18 pm

    On Thu, Apr 01, 2004 at 01:11:11PM -0500, Joshua Slive wrote:
    On Thu, 1 Apr 2004 ogjunk-h@yahoo.com wrote:
    If you request the file directly
    (http://yourhost.example.com/index.html)
    does it work?
    Yes, that does work.
    Are you sure the file is named *exactly* index.html, all lowercase,
    etc?
    Yes:
    Well, we have exhausted all the easy tests. Since I've never heard anyone
    with this particular problem before (DirectoryIndex being ignored), it is
    I actually posted a mail about it: DirectoryIndex
    was in fact ignored.

    The reason was that in my case I had

    <Directory /usr/share/request-tracker3/html>
    DirectoryIndex "index.html"
    SetHandler perl-script
    ...

    It did not worked (apache 2.0.48). See two letters about mod_dir a few
    days ago.

    A half solution was that I changed SetHandler to AddHandler perl-script .html,
    and then it started to work for me...

    Best Regards,
    Baldvin


    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org
  • Ogjunk-h at Apr 3, 2004 at 2:05 pm
    This turned out to be caused by the midding 'ClearModuleList'
    directive.
    After I added that, my index.html started showing properly.

    Thanks for assistance, everyone.

    Otis


    --- Kovacs Baldvin wrote:
    On Thu, Apr 01, 2004 at 01:11:11PM -0500, Joshua Slive wrote:
    On Thu, 1 Apr 2004 ogjunk-h@yahoo.com wrote:
    If you request the file directly
    (http://yourhost.example.com/index.html)
    does it work?
    Yes, that does work.
    Are you sure the file is named *exactly* index.html, all
    lowercase,
    etc?
    Yes:
    Well, we have exhausted all the easy tests. Since I've never heard anyone
    with this particular problem before (DirectoryIndex being ignored),
    it is

    I actually posted a mail about it: DirectoryIndex
    was in fact ignored.

    The reason was that in my case I had

    <Directory /usr/share/request-tracker3/html>
    DirectoryIndex "index.html"
    SetHandler perl-script
    ...

    It did not worked (apache 2.0.48). See two letters about mod_dir a
    few
    days ago.

    A half solution was that I changed SetHandler to AddHandler
    perl-script .html,
    and then it started to work for me...

    Best Regards,
    Baldvin


    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server
    Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org
  • Wrolf Courtney at Apr 1, 2004 at 9:57 pm
    Iff Apache 2.x, do you have:

    LoadModule autoindex_module lib/apache/mod_autoindex.so

    or something similar?

    Wrolf

    Joshua Slive <joshua@slive.ca> wrote on 04/01/2004 10:52:41 AM:
    On Thu, 1 Apr 2004 ogjunk-h@yahoo.com wrote:
    Goal (pretty standard):
    Then the file is not specified in the request, load index.html in
    that directory. If there is no index.html, do _not_ allow directory
    browsing.

    Problem:
    I am getting 403 Forbidden and this error in my error_log:

    Directory index forbidden by rule: /www/htdocs
    DocumentRoot /www/htdocs
    DirectoryIndex index.html
    <Directory "/www/htdocs">
    Options FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    DirectoryIndex index.html
    </Directory>
    If you request the file directly (http://yourhost.example.com/index.html)
    does it work?

    Are you sure the file is named *exactly* index.html, all lowercase, etc?

    Are there any other DirectoryIndex directives (for example, in an
    .htaccess file) that could be overriding this one?

    Joshua.

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org
  • Ogjunk-h at Apr 2, 2004 at 12:50 pm
    This is Apache 1.3.29, but I've got something similar:

    LoadModule autoindex_module libexec/mod_autoindex.so

    So, this should be dynamically loaded.
    Also, httpd -l shows that I have mod_dir statically compiled into the
    binary, just like I wanted it.

    Does that give anyone any ideas?

    Thank you!
    Otis



    --- wrolf.courtney@donovandata.com wrote:



    Iff Apache 2.x, do you have:

    LoadModule autoindex_module lib/apache/mod_autoindex.so

    or something similar?

    Wrolf

    Joshua Slive <joshua@slive.ca> wrote on 04/01/2004 10:52:41 AM:
    On Thu, 1 Apr 2004 ogjunk-h@yahoo.com wrote:
    Goal (pretty standard):
    Then the file is not specified in the request, load index.html
    in
    that directory. If there is no index.html, do _not_ allow
    directory
    browsing.

    Problem:
    I am getting 403 Forbidden and this error in my error_log:

    Directory index forbidden by rule: /www/htdocs
    DocumentRoot /www/htdocs
    DirectoryIndex index.html
    <Directory "/www/htdocs">
    Options FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    DirectoryIndex index.html
    </Directory>
    If you request the file directly
    (http://yourhost.example.com/index.html)
    does it work?

    Are you sure the file is named *exactly* index.html, all lowercase, etc?
    Are there any other DirectoryIndex directives (for example, in an
    .htaccess file) that could be overriding this one?

    Joshua.

    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org
  • Rich Bowen at Apr 1, 2004 at 4:00 pm

    On Thu, 1 Apr 2004 ogjunk-h@yahoo.com wrote:

    Hello,

    I am having some difficulties configuring my Apache server.

    Goal (pretty standard):
    Then the file is not specified in the request, load index.html in
    that directory. If there is no index.html, do _not_ allow directory
    browsing.

    Problem:
    I am getting 403 Forbidden and this error in my error_log:

    Directory index forbidden by rule: /www/htdocs
    Yeah, that's what you just said you wanted to happen. Do not allow
    directory browsing.
    I am trying to set this up for a virtual host.
    I have this in my the virtual host section:

    DocumentRoot /www/htdocs
    DirectoryIndex index.html
    <Directory "/www/htdocs">
    Options FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    DirectoryIndex index.html
    </Directory>


    I can get rid of my error by adding 'Indexes' to the Options list.
    However, that then shows the directory listing (and index.html in it),
    instead of automatically loading index.html
    So, the directory in question does contain an index.html file? Can you
    load that index.html file if you request it explicitly? If not, what
    error message happens in that case?

    --
    Who can say where the road goes
    Where the day flows
    Only time
    --Pilgrim (Enya - A Day Without Rain)


    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org
  • Ogjunk-h at Apr 1, 2004 at 4:33 pm

    --- Rich Bowen wrote:
    On Thu, 1 Apr 2004 ogjunk-h@yahoo.com wrote:

    Hello,

    I am having some difficulties configuring my Apache server.

    Goal (pretty standard):
    Then the file is not specified in the request, load index.html in
    that directory. If there is no index.html, do _not_ allow directory
    browsing.

    Problem:
    I am getting 403 Forbidden and this error in my error_log:

    Directory index forbidden by rule: /www/htdocs
    Yeah, that's what you just said you wanted to happen. Do not allow
    directory browsing.
    Yes, but if the directory contains index.html, I want Apache to display
    that file if no file is specified in the request.
    However, that then shows the directory listing (and index.html in it),
    instead of automatically loading index.html
    So, the directory in question does contain an index.html file? Can
    you
    load that index.html file if you request it explicitly? If not, what
    error message happens in that case?
    Yes, index.html is in the directory in question (root dir), and when I
    go to it directly (i.e. http://...../index.html), I do get the page.

    So I need to get Apache to load this page even when I go to /.

    Thanks,
    Otis


    ---------------------------------------------------------------------
    The official User-To-User support forum of the Apache HTTP Server Project.
    See <URL:http://httpd.apache.org/userslist.html> for more info.
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    " from the digest: users-digest-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesapache
postedApr 1, '04 at 3:47p
activeApr 3, '04 at 2:05p
posts10
users5
websitehttpd.apache.org
irc#httpd

People

Translate

site design / logo © 2022 Grokbase