# [ Solved ] You don't have permission to access server.

## CurtE

Okay.  It's been a long time and I know this is a common error in Apache.

After struggling with my 2nd server, I wiped out all of Apache2 and started from scratch.  I have a fresh install and going to http://70.89.201.9/ produces the right answer.

Then I added to /etc/apache2/modules.d/00_default_settings.conf

```
<Directory "/var/www/curt">

   Options -All -Multiviews

   <IfModule mod_access.c>

      Order allow,deny

      Allow from all

   </IfModule>

</Directory>
```

After trying to access http://70.89.201.9/curt and, obviously, not getting the results I expected, I kept searching.  Someone said that /etc/apache2/vhosts.d/00_default_vhost.conf is used to redirect even if you are not virtual hosting.  I proceeded to add:

```
<VirtualHost *:80>

  ServerName curt

  ServerAlias curt

  <Directory "/var/www/curt/">

    Allow from all

  </Directory>

  ServerPath /var/www/curt

  DocumentRoot /var/www/curt

</VirtualHost>
```

I'm still not getting to my test site, so what have I missed?

ADDON: Would any of this be caused by my ZONE records?Last edited by CurtE on Tue Mar 29, 2011 3:07 am; edited 2 times in total

----------

## chiefbag

Why don't you just use the default config since it looks like you only want to run one site on this instance. 

Delete your /etc/apache2 directory and re emerge apache again. 

Then place your website under /var/www/localhost/htdocs directory

----------

## CurtE

I'm taking baby steps to get it working on the 2nd server.  Eventually, I will be using the server for virtual hosting as I do with the first server.

----------

## chiefbag

You should not add the directory settings under the modules rather the default_vhost.include file. 

You can use the Alias command above the <directory> statement to direct to separate locations if you do not wish to use full vhost config which will only be useful if you are resolving to the server using dns names

----------

## CurtE

On the working server, I have in /var/www/localhost:

```
drwxrw-r--  2 root   root 4096 Aug 23  2009 cgi-bin

drwxrw-r--  3 root   root 4096 Oct 29  2008 error

drwxrw-r--  2 root   root 4096 Sep  4  2009 htdocs

drwxrw-r--  3 root   root 4096 Oct 29  2008 icons
```

But on the 2nd server, I just have htdocs.  Is there something I haven't run the setup on or what?

----------

## AllenJB

Your htdocs directory (the DocumentRoot) must be readable and executable by the "apache" user and/or "apache" group - usually the latter (configurable, but these are the defaults - some distros use "www-data" instead, for example). 

This is usually achieved by modifying the "other" permissions on files (the last 3 characters in the first column (permissions / properties) in the output below)

The files inside also need to be readable by the apache user/group.

"ls -l /var/www/localhost" on my setup:

```

drwxr-xr-x 3 root   root 4096 Sep 12 09:16 cgi-bin

drwxr-xr-x 4 root   root 4096 Feb 27  2009 htdocs

```

----------

## CurtE

This turned out to be a DNS server problem.  Once I had the DNS server setup properly, everything started to fall into place.

----------

