# Need Help for configuring Apache

## mouno

Hello, 

I need some help to configure my Apache webserver. I've already installed Apache, but the problem is that i'm unable to access the root directory. The server answers 403 Forbidden. I gave all permissions to the folder and files inside to all users.  I've modified the httpd file to specify the severname and the port. Here is the command I use to start the server:

```

apache2 -d <my_directory> -k start

```

I also have another problem. The command

```
 apache2ctl start 
```

gives this error

```

 * Starting eth2

 *   Configuration not set for eth2 - assuming DHCP

 *   Bringing up eth2

 *     dhcp

 *       network interface eth2 does not exist

 *       Please verify hardware or kernel module (driver)                        [ !! ]

 * Starting eth2

 *   Configuration not set for eth2 - assuming DHCP

 *   Bringing up eth2

 *     dhcp

 *       network interface eth2 does not exist

 *       Please verify hardware or kernel module (driver)                        [ !! ]

 * ERROR:  cannot start netmount as net.eth2 could not start

 * ERROR:  cannot start apache2 as net.eth2 could not start

```

This is quite normal since eth2 is not configured. The problem is I don't know where to change the configuration from eth2 to eth1 (which is the one I use to connect).

Any suggestion ?

----------

## the_g_cat

Do you have any /etc/init.d/net.eth2 or is eth2 mentioned in your /etc/conf.d/net? If so, you have to remove/delete them.

Your problem doesn't apache related, but rather comes from the gentoo initscript for apache wanting all network to be up before starting.

----------

## mouno

Tnx for the reply 

I've removed the file net.eth2 and now apache2ctl works without throwing any exception. But I still have that permission problem that prevents me accessing my files inside the root directory   :Rolling Eyes: 

----------

## the_g_cat

Well, what's with the basics here?

- Does the user apache is running as (I don't have a gentoo box to check right now, but it should be 'apache' in the group 'apache') have all the needed rights (at least +r on the files, +rx on the directories)?

- Is the directory you're trying to serve configured as "servable" in the apache config?

- What do the logs show?

- etc...

----------

## mouno

No problem with the groupe since i've added my account to the group apache and i'm running apache as root. No problem with the permission neither, since i gave +rwx to the directory and the files inside it to all users.

Concerning the "servable" stuff i'm not sure where to configure that. But I have the same permission problem even with the default directory.

Here are the log files:

access_log

```

127.0.0.1 - - [11/Mar/2008:13:40:01 +0100] "GET /favicon.ico HTTP/1.1" 403 272

127.0.0.1 - - [11/Mar/2008:13:40:11 +0100] "GET / HTTP/1.1" 403 261

127.0.0.1 - - [11/Mar/2008:13:40:19 +0100] "GET /home.html HTTP/1.1" 403 270

127.0.0.1 - - [11/Mar/2008:13:40:40 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:40:43 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:40:44 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:40:44 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:40:44 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:40:45 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:40:45 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:40:45 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:40:45 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:40:45 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:43:55 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:43:56 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:43:57 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:43:57 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:43:58 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:43:59 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:43:59 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:44:00 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:44:00 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:44:08 +0100] "GET / HTTP/1.1" 403 261

127.0.0.1 - - [11/Mar/2008:13:44:09 +0100] "GET / HTTP/1.1" 403 261

127.0.0.1 - - [11/Mar/2008:13:48:13 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:48:14 +0100] "GET /index.html HTTP/1.1" 403 271

127.0.0.1 - - [11/Mar/2008:13:48:22 +0100] "GET / HTTP/1.1" 403 261

127.0.0.1 - - [11/Mar/2008:19:35:50 +0100] "GET / HTTP/1.1" 403 261

127.0.0.1 - - [11/Mar/2008:19:35:51 +0100] "GET /favicon.ico HTTP/1.1" 403 272

127.0.0.1 - - [11/Mar/2008:19:36:43 +0100] "GET /favicon.ico HTTP/1.1" 403 272

127.0.0.1 - - [11/Mar/2008:19:43:32 +0100] "GET /favicon.ico HTTP/1.1" 403 272

127.0.0.1 - - [11/Mar/2008:19:44:15 +0100] "GET /favicon.ico HTTP/1.1" 403 272

127.0.0.1 - - [11/Mar/2008:19:44:17 +0100] "GET /favicon.ico HTTP/1.1" 403 272

127.0.0.1 - - [12/Mar/2008:13:42:59 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:13:42:59 +0100] "GET /favicon.ico HTTP/1.1" 403 274

127.0.0.1 - - [12/Mar/2008:13:43:55 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:13:43:56 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:13:44:01 +0100] "GET /index.html HTTP/1.1" 403 273

127.0.0.1 - - [12/Mar/2008:13:45:44 +0100] "GET /index.html HTTP/1.1" 403 273

127.0.0.1 - - [12/Mar/2008:13:45:45 +0100] "GET /index.html HTTP/1.1" 403 273

127.0.0.1 - - [12/Mar/2008:13:45:46 +0100] "GET /index.html HTTP/1.1" 403 273

127.0.0.1 - - [12/Mar/2008:13:46:07 +0100] "GET /search.html HTTP/1.1" 403 274

127.0.0.1 - - [12/Mar/2008:13:48:52 +0100] "GET /search.html HTTP/1.1" 403 274

127.0.0.1 - - [12/Mar/2008:13:48:53 +0100] "GET /search.html HTTP/1.1" 403 274

127.0.0.1 - - [12/Mar/2008:14:17:10 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:14:23:47 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:14:23:48 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:14:23:49 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:14:23:50 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:14:23:50 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:14:23:52 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:14:24:33 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:14:24:33 +0100] "GET / HTTP/1.1" 403 263

127.0.0.1 - - [12/Mar/2008:14:24:38 +0100] "GET /test.html HTTP/1.1" 403 272

127.0.0.1 - - [12/Mar/2008:14:24:43 +0100] "GET /index.html HTTP/1.1" 403 273

```

error_log:

```

[Tue Mar 11 13:40:45 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:43:55 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:43:56 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:43:57 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:43:57 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:43:58 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:43:59 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:43:59 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:44:00 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:44:00 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:44:08 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:44:09 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:47:53 2008] [notice] caught SIGTERM, shutting down

[Tue Mar 11 13:48:08 2008] [notice] Apache/2.2.8 (Unix) configured -- resuming normal operations

[Tue Mar 11 13:48:13 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:48:14 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 13:48:22 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 19:35:49 2008] [notice] Apache/2.2.8 (Unix) configured -- resuming normal operations

[Tue Mar 11 19:35:50 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 19:35:51 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 19:36:43 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 19:43:32 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 19:44:15 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Tue Mar 11 19:44:17 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:42:25 2008] [notice] Apache/2.2.8 (Unix) configured -- resuming normal operations

[Wed Mar 12 13:42:59 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:42:59 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:43:26 2008] [notice] caught SIGTERM, shutting down

[Wed Mar 12 13:43:45 2008] [notice] Apache/2.2.8 (Unix) configured -- resuming normal operations

[Wed Mar 12 13:43:55 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:43:56 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:44:01 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:45:44 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:45:45 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:45:46 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:46:07 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:48:52 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 13:48:53 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:16:42 2008] [notice] caught SIGTERM, shutting down

[Wed Mar 12 14:16:46 2008] [notice] Apache/2.2.8 (Unix) configured -- resuming normal operations

[Wed Mar 12 14:17:10 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:23:34 2008] [notice] caught SIGTERM, shutting down

[Wed Mar 12 14:23:41 2008] [notice] Apache/2.2.8 (Unix) configured -- resuming normal operations

[Wed Mar 12 14:23:47 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:23:48 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:23:49 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:23:50 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:23:50 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:23:52 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:24:30 2008] [notice] SIGHUP received.  Attempting to restart

[Wed Mar 12 14:24:30 2008] [notice] Apache/2.2.8 (Unix) configured -- resuming normal operations

[Wed Mar 12 14:24:33 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:24:33 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:24:38 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Wed Mar 12 14:24:43 2008] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

                                                                                                          

```

----------

## elgato319

edit /etc/conf.d/apache2

is "-D DEFAULT_VHOST" set in APACHE2_OPTS= ?

if not put it in and restart apache with the init.d skript

```
/etc/init.d/apache2 restart
```

----------

## mouno

it was already set

```

 APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST"

```

----------

## the_g_cat

Well, as your error_log clearly states, your apache is misconfigured. I recommend to restart from a clean apache installation and especially configuration.

----------

