# Apache2 Forbidden

## gilkyboy

I recently emerged apache2.  I couldn't get it to work right using the normal apache e-build, so I unmerged it then emerged the ACCEPT_... one.  I get it started and all but I get 403 forbidden errors when I try to access it.  I checked and the user apache and the group apache were added.  The /etc/passwd file says that /home/httpd is the user directory whereas the apache2.conf file says /var/www/localhost/htdocs is the directory it should be.  Basically all I've done (and know how to do) is emerge apache mod mod_ssl and rc-update add apache2 default .  What do I need to do to get this running?  Thanks in advance for any help you guys can give, you guys have been great in the past.

----------

## Qweasda

Hi, can't help you but I get the 403 errors also. Here's a post I made the other day:

https://forums.gentoo.org/viewtopic.php?t=97683

I wish I could get this going...

----------

## darfsnuzal

Does /var/www/localhost/htdocs exist and if so what does an ls -la show?

----------

## Qweasda

I unmerged the ebuild and installed Apache from source, so it uses /usr/local/apache2/htdocs instead:

```

total 150

drwxr-xr-x    2 root     root         1352 Oct 16 20:03 .

drwxr-xr-x   15 root     root          360 Oct 16 19:54 ..

-rwxr-xr-x    1 verbal   users        2326 Jul  2  1996 apache_pb.gif

-rwxr-xr-x    1 verbal   users        1385 May 30  2001 apache_pb.png

-rwxr-xr-x    1 verbal   users        2414 May  2  2001 apache_pb2.gif

-rwxr-xr-x    1 verbal   users        1463 May 30  2001 apache_pb2.png

-rwxr-xr-x    1 verbal   users        2160 May  2  2001 apache_pb2_ani.gif

-rwxr-xr-x    1 verbal   users         102 Oct 14 16:03 index.html

-rwxr-xr-x    1 verbal   users        1663 May 20  2002 index.html.ca

-rwxr-xr-x    1 verbal   users        1583 Sep 28  2001 index.html.cz.iso8859-2

-rwxr-xr-x    1 verbal   users        2202 Feb 14  2002 index.html.de

-rwxr-xr-x    1 verbal   users        1508 Jan 19  2001 index.html.dk

-rwxr-xr-x    1 verbal   users        1828 Jan 19  2001 index.html.ee

-rwxr-xr-x    1 verbal   users        1618 Jan 19  2001 index.html.el

-rwxr-xr-x    1 verbal   users        1456 May  3  2001 index.html.en

-rwxr-xr-x    1 verbal   users        1735 Jan 19  2001 index.html.es

-rwxr-xr-x    1 verbal   users        1867 Nov 14  2000 index.html.et

-rwxr-xr-x    1 verbal   users        1505 Sep 28  2001 index.html.fr

-rwxr-xr-x    1 verbal   users        3704 Jan 20  2001 index.html.he.iso8859-8

-rwxr-xr-x    1 verbal   users        1604 Oct  1  2001 index.html.hr.iso8859-2

-rwxr-xr-x    1 verbal   users        1788 Nov  7  2001 index.html.it

-rwxr-xr-x    1 verbal   users        1630 Sep 28  2001 index.html.ja.iso2022-jp

-rwxr-xr-x    1 verbal   users        1543 Jun 10  2002 index.html.ko.euc-kr

-rwxr-xr-x    1 verbal   users        1837 May 20  2002 index.html.lb.utf8

-rwxr-xr-x    1 verbal   users        1968 Jan 19  2001 index.html.nl

-rwxr-xr-x    1 verbal   users        1534 Sep  6  2001 index.html.nn

-rwxr-xr-x    1 verbal   users        1467 Jan 19  2001 index.html.no

-rwxr-xr-x    1 verbal   users        1438 Sep 28  2001 index.html.po.iso8859-2

-rwxr-xr-x    1 verbal   users        1773 Jan 19  2001 index.html.pt

-rwxr-xr-x    1 verbal   users        2046 Feb 12  2003 index.html.pt-br

-rwxr-xr-x    1 verbal   users        1522 Jan 19  2001 index.html.ru.cp-1251

-rwxr-xr-x    1 verbal   users        1515 Sep 28  2001 index.html.ru.cp866

-rwxr-xr-x    1 verbal   users        1520 Jan 19  2001 index.html.ru.iso-ru

-rwxr-xr-x    1 verbal   users        1516 Jan 19  2001 index.html.ru.koi8-r

-rwxr-xr-x    1 verbal   users        2249 Jan 19  2001 index.html.ru.utf8

-rwxr-xr-x    1 verbal   users        1631 Mar  7  2003 index.html.sv

-rwxr-xr-x    1 verbal   users        2401 May 28 13:45 index.html.var

-rwxr-xr-x    1 verbal   users        1018 May 28 13:45 index.html.zh-cn.gb2312

-rwxr-xr-x    1 verbal   users        1032 May 13 15:17 index.html.zh-tw.big5

```

I've tried chmod -R 777 htdocs...nothing. Same with the ebuild in /var/www/...

Like stated in my threat, my FTP server works fine, anonymous users and all. VNC and SSH as well.

----------

## thecooptoo

what is the very first directive in commonapache.conf

try something like this  to open up the whole lot 

<Directory />

  Options -All -Multiviews

  AllowOverride None

#AllowOverride All

  <IfModule mod_access.c>

    Order deny,allow

#    Deny from all

        Allow from all

  </IfModule>

</Directory>

and  put a simple file in your document root

eg

<html><body><h1>Hello World</h1></body><.html>

called index.html

----------

## Qweasda

I did that, same result.

What else could it be that's outside of Apache? hosts.allow/deny, etc.

----------

## gilkyboy

I have an index file in /var/www/localhost/htdocs, and have tested a basic test.php script (also in /var/www/localhost/htdocs ) by typing lynx http://localhost/test.php and still get the forbidden error.  I have hosts allow from all setup and all that good stuff.  Nothing works.  That's why I posted about the apache user directory - should it be something different?  do I need to make /var/www/localhost owned by apache?  shouldn't that have been setup with the e-build.  I googled this for hours but found nothing specifically relevant.  Any help you guys can give would again be greatly appreciated.  Thanks in advance, Gilkyboy

----------

## thecooptoo

chmod  /var/www/localhost/ downwards to the user:group in commonapache2.conf ( ?apache:apache)

----------

## Qweasda

Did that, still didn't work.

----------

## thecooptoo

whats in the errorlog (etc/apache2/log/error_log

----------

## thecooptoo

and can you access your index page it from http://127.0.0.1 ?

----------

## gilkyboy

Although I've done chmodding on webservers a long time ago, I don't recall how I do this anymore.  What do I chmod it to?  how do I setup apache:apache (which is what my configuration file says is the user and group) as the owner?  Thanks again for all your wisdom, I can't thank you enough.

----------

