# Setup home directories with Apache...

## nostabo

I would like to use my home directories to store my public_html directories for each of my users...actually its just me.

How do I configure Apache2 to do this when I am logged on as a normal user?

I expect that http://locahost/~username should show the current user's public_html directory.

----------

## ep98

By default is it open in Apache 2.0.5x check in /etc/apache2/conf/commonapache2.conf

on section:

....

###

### UserDir: The name of the directory which is appended onto a user's home

### directory if a ~user request is received.

###

<IfModule mod_userdir.c>

    UserDir public_html

</IfModule>

----------

## nostabo

Thanks, but that is how it is setup, and when I enter the address:

```
http://localhost/~username
```

I get the following error:

 *Quote:*   

> Forbidden
> 
> You don't have permission to access /~username/ on this server.
> 
> Apache/2.0.50 (Gentoo/Linux) PHP/5.0.1 Server at 127.0.0.1 Port 80

 

The permissions to my ~/home are 755 and to the public_html within are 701.  Everything works fine locally when I run things from the /var/www/localhost/htdocs directory.

----------

## ep98

 *nostabo wrote:*   

> Thanks, but that is how it is setup, and when I enter the address:
> 
> ```
> http://localhost/~username
> ```
> ...

 

Simply put index.html with one word inside public_html and everything will be fine  :Smile: 

----------

## nostabo

Thanks, but that doesn't help, either.  I already had an index.php file there and adding the index.html did nothing.

----------

## Googolplex

Same exact problem here.

It would be so much easier for me if I could get this to work.

If anyone has an answer please help!

----------

## Fylar

Hi.. I'm not sure if this will help or not...

I just managed to get mine working.  :Smile: 

This is what I did..

<code>

emerge php

emerge apache

emerge php_mod

// Edited /etc/conf.d/apache2 to have this line

APACHE2_OPTS="-D PHP4"

/etc/init.d/apache2 start

mkdir ~/public_html

Copied various php & html files into public_html

chmod 755 -R ~/public_html

//I then opened in my browser

http://localhost/~fylar/

</code>

HTH

Fylar

----------

## Acieke

Also make sure to o+x /home itself and verify ur DocumentIndex (try http://localhost/~user/index.html)

g/l

Ace

----------

## nostabo

 *Quote:*   

> Also make sure to o+x /home itself and verify ur DocumentIndex

 

So what do you mean by "o+x"?

----------

## fleed

o = others

x = execute.

All directories must be eXecutable until the public_html, otherwise apache won't be able to get to your html files. So you should do:

```

chmod o+x /home

chmod o+x /home/luser1

chmod o+x /home/luser2

```

where luser1 and luser2 are the users you wish to have their files accessible.

----------

## hds

```

<Directory /home/*/public_html>

    AllowOverride FileInfo AuthConfig Limit

    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

    <Limit GET POST OPTIONS PROPFIND>

        Order allow,deny

        Allow from all

    </Limit>

    <LimitExcept GET POST OPTIONS PROPFIND>

        Order deny,allow

        Deny from all

    </LimitExcept>

</Directory>

```

in my config this was disabled by default, so it didnt work. guess you guys have the same problem.

----------

## iuli

I had exactly the same problems, it seems by default home directories are not readable/executable by others, so what I needed to do was just to 

```
chmod o+x /home/iuli
```

, where my home is...

thanks, l33t

----------

