# need apache help

## mesman00

so i just finished installing apache and php.  when i go to 

http://localhost

i get the default apache page.  now, in what directory can i put my webfiles so i can browse to them?  i tried to put a folder in "/var/www" but when i then do http://localhost/folder name i get a not found page.  can anyone help? thanks.

----------

## Summit

Hello

You need to make your site in the /var/www/html/ folder.  Say I have index.html in /var/www/html/, I would type http://localhost/index.html to access it.  Have fun with PHP.

----------

## thorpe

What does...

```

cat /etc/apache/httpd.conf | grep "DocumentRoot"

```

produce?

I think (not at my server) the default web root on Gentoo is /var/www/localhost/htdocs

----------

## rizzurant

edit the httpd.conf at your Apache Configuration directory

and point the DocumentRoot to your web directory

have a nice day  :Mr. Green: 

----------

## mesman00

 *Quote:*   

> You need to make your site in the /var/www/html/ folder. Say I have index.html in /var/www/html/, I would type http://localhost/index.html to access it. Have fun with PHP.

 

since my site is is written in HTML/PHP, should i make a folder /var/www/PHP and put the index.php in there?  i'm at work right now so i can't try this.

and one last thing, how can i give permission to /var/www so it not only has root access, but user access as well.  i know this is a noob question, and its kinda shameful that i'm asking after using gentoo for 3 years.   :Embarassed: .  and i have previously used apache (via wamp install) in windows for all my web-serving needs, so hence the apache questions.  there wouldn't happen to be a similar package to wamp for linux, is there?

----------

## yaman666

 *mesman00 wrote:*   

> 
> 
> since my site is is written in HTML/PHP, should i make a folder /var/www/PHP and put the index.php in there?  i'm at work right now so i can't try this.
> 
> and one last thing, how can i give permission to /var/www so it not only has root access, but user access as well.  i know this is a noob question, and its kinda shameful that i'm asking after using gentoo for 3 years.  .  and i have previously used apache (via wamp install) in windows for all my web-serving needs, so hence the apache questions.  there wouldn't happen to be a similar package to wamp for linux, is there?

 

Your default configuration probably has /var/www/localhost/htdocs as root, unless you changed it. You put index.php wherever your Document Root points to. Just remember to emerge php and configure apache to use it.

----------

## mesman00

ok thanks....can you point me to where i need to go to configure apache to use PHP (like a document)?  thanks.

----------

## battra

http://gentoo-wiki.com/Apache_Modules_PHP

----------

## mesman00

when i run

```
cat /etc/apache/httpd.conf | grep "DocumentRoot" 
```

nothing is returned, just a blank line.  when i search the doc for DocumentRoot i get no search results either.  so why do i not have a document root directory?

----------

## yaman666

 *mesman00 wrote:*   

> when i run
> 
> ```
> cat /etc/apache/httpd.conf | grep "DocumentRoot" 
> ```
> ...

 

May be you have vhosts flag enabled? That means apache was compiled with virtual hosts configuration and in that case, it would create a default vhosts root under /etc/apache/vhosts/00_default_vhost.conf

You may also need to enable DEFAULT_VHOST in /etc/conf.d/apache2

```
APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5"
```

----------

## mesman00

i didn't use vhost flag, and i do have default_vhost option at you have shown.

----------

## yaman666

And you do not have a vhosts.d directory in your /etc/apache? (I'm not sure what apache installs when you don't use the flag)

Could you post your httpd.conf here then so we can see?

----------

## stupidkid

I'm also having the exact problem. I just installed Gentoo not long ago and apache came with it (actually it probably came with some dependency I didn't pay too much attention). And DocumentRoot did not exist in my httpd.conf but when I add it, nothing seems to happen (yes I did restart apache, and at first I didn't create the dir /www and the startup even told me). Does anyone know how to fix this? My only two use flags for apache are apache2 and ssl

----------

## gorbehnare

mmm.... i have the exact same problem here.... i think i have followed through everything.

sorry, but where is httpd.conf? i just can't find it or i'm doing something stupid.

----------

## dobysirius

Assuming you use apache 2, it might be in /etc/apache2/httpd.conf

----------

## gorbehnare

 *dobysirius wrote:*   

> Assuming you use apache 2, it might be in /etc/apache2/httpd.conf

 

thank you... the problem is solved... i'm still confused on how my brother fixed it... it seems like PHP was not compiled properly or something like that. I got to get him to post what he did.

thanks again

----------

## stupidkid

But does anyone know why DocumentRoot "/(anypath)" doesn't work? I didn't include the / at the end of the path, since the conf file told me not to.

----------

## magic919

 *stupidkid wrote:*   

> But does anyone know why DocumentRoot "/(anypath)" doesn't work? I didn't include the / at the end of the path, since the conf file told me not to.

 

I have

DocumentRoot "/var/www/localhost/htdocs"

in my vhosts file and it certainly works.

----------

## stupidkid

 *magic919 wrote:*   

>  *stupidkid wrote:*   But does anyone know why DocumentRoot "/(anypath)" doesn't work? I didn't include the / at the end of the path, since the conf file told me not to. 
> 
> I have
> 
> DocumentRoot "/var/www/localhost/htdocs"
> ...

 

Sorry for asking, but where is the vhosts file?   :Confused: 

----------

## magic919

On mine it's in

/etc/apache2/vhosts.d/

----------

## stupidkid

Awesome, that works. Thanks a lot.   :Very Happy: 

----------

