# [ Solved ] Apache URL dilemma.

## CurtE

As usual, it's my fault.  LOL.

The problem is this:

I have a virtual host/static IP - www.cs-mn.com that works fine.

What I want to do, is use the site for public and private areas.  Within the site, there is a link to www.cs-mn.com/port (public).

Also, I have www.cs-mn.com/rock (private).

Both give me this error:

Error 403.

Forbidden

You don't have permission to access /rock on this server.

and the Apache error log shows:

client denied by server configuration: /var/www/rock, referer: https://forums.gentoo.org/posting.php

How do I set this up properly?

```

drwxr-xr-x  3 root   root 4096 Feb 18 00:15 cs-mn.com

drwxr-xr-x  2 root   root 4096 Feb 12 14:45 rock

```

/etc/apache2/00_default_settings.conf looks like this.

```

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

UseCanonicalName Off

AccessFileName .htaccess

ServerTokens Prod

TraceEnable off

ServerSignature On

HostnameLookups Off

#EnableMMAP off

#EnableSendfile off

ErrorLog /var/log/apache2/error_log

LogLevel warn

# We configure the "default" to be a very restrictive set of features.

<Directory />

  Options FollowSymLinks

  AllowOverride None

  Order deny,allow

  Deny from all

</Directory>

alias /rock /var/www/rock

<Directory "/var/www/rock">

   Options -All -Multiviews

   <IfModule mod_access.c>

     Order allow,deny

     Allow from all

   </IfModule>

</Directory>

alias /port /var/www/portfolio

<Directory "/var/www/portfolio">

   Options -All -Multiviews

   <IfModule mod_access.c>

     Order allow,deny

     Allow from all

   </IfModule>

</Directory>

<IfModule dir_module>

  DirectoryIndex index.html index.html.var

</IfModule>

<FilesMatch "^\.ht">

  Order allow,deny

  Deny from all

</FilesMatch>

```

/etc/apache2/vhosts.d/00_default_vhost.conf looks like this:

```
# Virtual Hosts

<IfDefine DEFAULT_VHOST>

Listen 80

# Use name-based virtual hosting.

NameVirtualHost *:80

<VirtualHost *:80>

  ServerName localhost

  Include /etc/apache2/vhosts.d/default_vhost.include

  <IfModule mpm_peruser_module>

    ServerEnvironment apache apache

  </IfModule>

</VirtualHost>

<VirtualHost *:80>

  ServerName Blackhole

  ErrorDocument 403 "Houston, we have a problem."

  RewriteEngine On

  RewriteRule . - [F]

</VirtualHost>

<VirtualHost *:80>

  DocumentRoot /var/www/cs-mn.com

  ServerName cs-mn.com

  ServerAlias *.cs-mn.com cs-mn.com

  ServerAdmin admin@cs-mn.com

  ServerPath /var/www/cs-mn.com

  <Directory /var/www/cs-mn.com/>

    Order Allow,Deny

    Allow from All

  </Directory>

</VirtualHost>

</IfDefine>

```

Last edited by CurtE on Tue Feb 22, 2011 12:38 am; edited 1 time in total

----------

## cach0rr0

a few quick things

-need to chown those dirs to apache:apache

-is it possible you've disabled Indexes within apache, and that those directories don't have an index.something? (e.g. index.htm, index.html, index.php)

if this is the case, after youve apache:apache'd those directories, drop in an .htaccess file with Options +Indexes, making sure to also chown this to apache;apache

The usual suspects as well, directories should be 755, files should be 644, but that does look correct on yours unless a subdir somewhere is wrong

----------

## CurtE

Since I have my own servers, I don't have a .htaccess.  :Sad: 

----------

## cach0rr0

 *CurtE wrote:*   

> Since I have my own servers, I don't have a .htaccess. 

 

```

echo "Options +Indexes" > /var/www/cs-mn.com/.htaccess

chown apache:apache /var/www/cs-mn.com/.htaccess

```

They don't exist by default; you create them.

We may have to add an AllowOverride All to the Directory section, if that doesn't exist in the default configuration, but try the above first.

----------

## CurtE

```
[Mon Feb 21 14:55:52 2011] [error] [client 10.1.10.31] File does not exist: /var/www/cs-mn.com/none, referer: http://www.cs-mn.com/

[Mon Feb 21 14:55:54 2011] [error] [client 10.1.10.31] client denied by server configuration: /var/www/portfolio, referer: http://www.cs-mn.com/
```

same results

In /var/www

```

drwxr-xr-x  3 root   root 4096 Feb 21  2011 cs-mn.com

drwxr-xr-x  9 root   root 4096 Feb 12 14:45 portfolio

```

In /var/www/cs-mn.com

```

drwxr-xr-x  3 root   root     4096 Feb 21  2011 .

drwxr-xr-x 10 apache root     4096 Feb 17 14:34 ..

-rw-r--r--  1 apache apache     17 Feb 21  2011 .htaccess

-rw-r--r--  1 root   root   204862 Feb 17 23:11 favicon.ico

drwxr-xr-x  2 root   root     4096 Feb  9 02:15 images

-rwxr-xr--  1 root   root     1336 Feb 17 16:08 index.html

-rw-r--r--  1 root   root      123 Oct  3 20:07 robots.txt

```

/var/www/cs-mn.com/.htaccess

```

Options +Indexes

```

Is this in a different spot then what I have in the top of the thread?

```
We may have to add an AllowOverride All to the Directory section, if that doesn't exist in the default configuration, but try the above first.
```

BTW, can you give me a layman explanation on the:

Deny, Allow, Deny from All and Allow from All stuff.

----------

## CurtE

Solved the problem.  I added this to /etc/apache2/module.d/00_default_settings.conf

```
<Directory /var/www>

  Options FollowSymLinks

  AllowOverride All

  Order allow,deny

  Allow from all

</Directory>

```

Now I can get to the different sites.  

E.G., www.cs-mn.com/rock which is pictures I have of different rocks that my step-father was collecting.

----------

