# Apache2 Driving me MAD (HELP ME)

## Dr_Dooom33

In reference to:

GENTOO WIKI SITE

http://gentoo-wiki.com/HOWTO_Apache_VirtualHost_by_IP_Address

THREAD

https://forums.gentoo.org/viewtopic-p-2686304.html#2686304

After following gentoo wiki instructions I am failing:  :Confused:   :Confused:   :Confused:   :Confused:   :Confused:   :Confused: 

/etc/init.d/apache2 restart

 * Starting apache2 ...

[Fri Oct 14 09:03:26 2005] [warn] NameVirtualHost *:80 has no VirtualHos   [ !! ]

/etc/apache2/conf/apache2.conf

```

### Main Configuration Section

### You really shouldn't change these settings unless you're a guru

###

ServerRoot /usr/lib/apache2

ServerName yourserver.yourdomain.com

#LockFile /etc/apache2/apache2.lock

PidFile /var/run/apache2.pid

ErrorLog logs/error_log

LogLevel warn

DocumentRoot /var/www/localhost/htdocs 

###

### Virtual Hosts

###

# We include different templates for Virtual Hosting. Have a look in the

# vhosts directory and modify to suit your needs.

Include conf/vhosts/vhosts.conf

#Include conf/vhosts/dynamic-vhosts.conf

#Include conf/vhosts/virtual-homepages.conf 

```

/etc/conf.d/apache2

```

# Config file for /etc/init.d/apache2

# An example from /etc/apache2/conf/modules.d/40_mod_ssl.conf:

#

# <IfDefine SSL>

#  <IfModule !mod_ssl.c>

#    LoadModule ssl_module    extramodules/mod_ssl.so

#  </IfModule>

# </IfDefine>

#

# This means that the mod_ssl.so DSO module is only loaded

# into the server when you pass "-D SSL" at startup.  To

# enable WebDAV, add "-D DAV -D DAV_FS".  If you installed

# mod_php then add "-D PHP4".  For more options, please

# read the files in the /etc/apache2/conf/modules.d directory.

APACHE2_OPTS="-D PHP4 -D SSL"

```

/etc/apache2/conf/vhosts/vhosts.conf

```

#### LocalHost aka Domain 1 ####

 <VirutalHost my.ip.add.ress>

       ServerName www.mydomain1.com

       ServerPath /mydomain1.com

       DocumentRoot /var/www/localhost/htdocs

 </VirtualHost>

 #### Domain 2 ####

 <VirtualHost my.ip.add.ress>

        ServerName www.mydomain2.com

        DocumentRoot /var/www/mydomain2.com/htdocs

        <Directory "/var/www/mydomain2.com/htdocs">

          Options None

          AllowOverride None

          Order allow,deny

          Allow from all

        </Directory>

 </VirtualHost>

 #### Replicate Domain 2 for further Domains ####

                                ""

                               "" 

<Directory "/var/www/mydomain2.com/htdocs">

         Options None

         AllowOverride None

         Order allow,deny

         Allow from all

</Directory>

```

 /etc/apache2/listen.conf  (I had no listen.conf file so I made one)

```

NameVirtualHost *

```

```
[color=green] 

# /etc/init.d/apache2 restart

```

[/color]

Then I get

```

/etc/init.d/apache2 restart

 * Starting apache2 ...

[Fri Oct 14 09:03:26 2005] [warn] NameVirtualHost *:80 has no VirtualHos [ !! ]

```

Im frustrated    :Evil or Very Mad:   :Evil or Very Mad:   :Evil or Very Mad:   :Evil or Very Mad: 

----------

## c4

Dr_Dooom33, from the guide you mentioned  *Quote:*   

> It also assumes that you are using IP Aliasing. But if you are not and you use name based vitual host you can simply replace the "VirtualHost MY.IP.ADD.RESS" with *:80 or whatever..

 

I see that for Apache I use the *:80 setup for my virtual hosts:

(vhosts.conf)

```
<VirtualHost *:80>

ServerName domainname.com

ServerAlias domainname.com

DocumentRoot /www/domainname

   <Directory "/www/domainname">

     allow from all

    </Directory>

</VirtualHost>
```

and simular for my second virtualhost:

```
<VirtualHost *:80>

ServerName domainname2.com

ServerAlias domainname2.com

DocumentRoot /www/domainname2

   <Directory "/www/domainname2">

     allow from all

    </Directory>

</VirtualHost>
```

and it works just fine.

----------

## Onkobu

You uncommented the server root and included the vhosts.conf RELATIVE (no trailing slash) to this server root, does vhosts.conf exist under $SERVER_ROOT/$VHOST_CONF? (I remember that there's a lot of linking on x86_64, lib, lib32, lib64...)

----------

## jonnevers

 *Dr_Dooom33 wrote:*   

> Im frustrated      

 

I'd like to just throw this out there.

If you are using the most recent version of apache2 in portage your configuration files are in the wrong locations.

reference:

http://www.gentoo.org/doc/en/apache-upgrading.xml

This is a guide to correcting the configuration file issues brought on by the changes in the newest ebuild.

for instance: /etc/apache2/conf/apache2.conf 

should be /etc/apache2/httpd.conf and vhosts are in /etc/apache2/vhosts/vhosts.conf.

I had the exact same error message when starting/stopping apache2 after updating it but prior to changin gmy config file locations.

frustrating is an understatement   :Evil or Very Mad: 

- Jon

----------

## DNAspark99

if you havn't allready....I recommend upgrading to the newest ebuild, you may as well get whatever 'breakage' you'll encounter over with now, rather than fix this issue only to break it when you eventually DO upgrade...  :Razz: 

might want to try:

/etc/conf.d/apache2:

 *Quote:*   

> 
> 
> APACHE2_OPTS="-D DEFAULT_VHOST -D SSL_DEFAULT_VHOST -D SSL -D PHP4" 
> 
> 

 

That should set up everything you need for vhosts, you shouldn't need to fiddle with the httpd.conf to get this working

It will greatly 'simplify' a few things if you split your individual vhosts into seperate .conf files, put them in /etc/apache2/vhosts.d/, and just make sure that you have "Include /etc/apache2/vhosts.d/*.conf" as the last line of /etc/apache2/httpd.conf (believe this is default now anyways)

----------

## elcman

 *DNAspark99 wrote:*   

> 
> 
> might want to try:
> 
> /etc/conf.d/apache2:
> ...

 

Doesn't this disallow Apache2 from even running? If it sees the old config files in the old locations it will now allow Apache2 to start.

 *init.d/apache2 wrote:*   

> 
> 
>         # check to see if the old config files exist and aren't used
> 
>         if [[ "${CONFIGFILE}" != "/etc/apache2/conf/apache2.conf" &&
> ...

 

If this is the case, where do I Define The following?

 *Obsolete conf.d/apache2.conf wrote:*   

> 
> 
> APACHE2_OPTS="-D DEFAULT_VHOST -D SSL_DEFAULT_VHOST -D SSL -D PHP4" 
> 
> 

 

Because if I put this verbatim into httpd.conf I get:

* Apache2 has detected a syntax error in your configuration files:

Syntax error on line 1095 of /etc/apache2/httpd.conf:

Invalid command 'APACHE2_OPTS="-D', perhaps mis-spelled or defined by a module not included in the server configuration

So, where do I Define each of these elements? The modules.d loading process doesn't seem to pick them up.

Any help would be awesome.  :Smile: 

----------

## c4

 *elcman wrote:*   

> If this is the case, where do I Define The following?
> 
>  *Obsolete conf.d/apache2.conf wrote:*   
> 
> APACHE2_OPTS="-D DEFAULT_VHOST -D SSL_DEFAULT_VHOST -D SSL -D PHP4" 
> ...

 

Those options are to be used in the /etc/conf.d/apache2 file, when using the new Apache setup including httpd.conf. If you are using the old Apache server setup with the apache.conf/commonapache.conf files, then I think that the /etc/conf.d/apache2 should be like 

```
APACHE2_OPTS="-D SSL -D PHP4" 
```

 instead.. but check the guides because I'm not sure about the old setup anymore. I don't have any older configs to check here either I'm afraid.

----------

## DNAspark99

yes, that's my point - if you havn't upgraded yet, do it now, save yourself the trouble later!

the new apache layout is a bit better, having httpd.conf makes more sense, and configs can be switched pretty quickly... in my case, the upgrade consisted of:

(after latest apache2 freshly merged)

```

mv /etc/apache2/conf/vhosts/*.conf /etc/apache2/vhosts.d/

mv /etc/apache2/conf/ssl/* /etc/apache2/ssl/

mv /etc/apache2/conf /etc/apache2/OLDconf

```

...THEN my previous post will make more sense :p

----------

## Dr_Dooom33

how do I emerge the latest?

Sorry Im a NooB

emerge apache

right or do I have to give a particular version name to get the latest?

Do I need to unmerge the current apache?

----------

## Dr_Dooom33

Onkobu

 *Quote:*   

> You uncommented the server root and included the vhosts.conf RELATIVE (no trailing slash) to this server root, does vhosts.conf exist under $SERVER_ROOT/$VHOST_CONF? (I remember that there's a lot of linking on x86_64, lib, lib32, lib64...)

 

I dont understand can you explain to a noob please

----------

## DNAspark99

 *Dr_Dooom33 wrote:*   

> how do I emerge the latest?
> 
> Sorry Im a NooB
> 
> emerge apache
> ...

 

emerge sync && emerge apache

----------

## elcman

 *c4 wrote:*   

>  *elcman wrote:*   If this is the case, where do I Define The following?
> 
>  *Obsolete conf.d/apache2.conf wrote:*   
> 
> APACHE2_OPTS="-D DEFAULT_VHOST -D SSL_DEFAULT_VHOST -D SSL -D PHP4" 
> ...

 

I went through and looked at different methods of configuration. Most of which I tried manually. The additions to the /etc/conf.d/apache2.conf didn't crap out like I expected it would, but it didn't actually define it either. I am closer to understanding the problem, but the solution still seems to be as far away as ever. 

I tried putting this same information into the apache2common.conf as well and I had similar results, it doesn't load modules correctly.

In the default VHOST configuration file, I have to comment out the <IsDefined DEFAULT_VHOST> or it will give me the usualy "no VHOST" error.

The above configuration line seems to be correct as I have been checking all of the <IsDefined> tags and seeing that the appropriate names are called. Am I doing something very wrong? Right now, my PHP scripts won't execute. It just doesn't recognize them as anything more than a text file. The commands are imbedded in the PHP4 module, but unless I can somehow define the environment, I won't be able to get it running without Jerry-rigging it.

I've looked through the documentation... maybe I'm just looking in the wrong place.

-- Edit

 *The Docs wrote:*   

> 
> 
> Note: Many modules that used to be enabled by default are now disabled. If they are apache built-in modules, then uncomment the appropriate line in httpd.conf. If they are external modules, check the module's .conf for IfDefine and add the name to /etc/conf.d/apache{|2} to enable it.
> 
> 

 

Ok, I was looking in the wrong place.

----------

## Onkobu

 *Dr_Dooom33 wrote:*   

> Onkobu
> 
>  *Quote:*   You uncommented the server root and included the vhosts.conf RELATIVE (no trailing slash) to this server root, does vhosts.conf exist under $SERVER_ROOT/$VHOST_CONF? (I remember that there's a lot of linking on x86_64, lib, lib32, lib64...) 
> 
> I dont understand can you explain to a noob please

 

That happens, but it's not your fault. Due to your lack of knowledge you should look for help not only here. There are a lot of man pages (emerge, portage, equery), many How To's (esp. gentoo with it's wikis) and tons of screen messages.

Do not just "emerge world" but spool it to some file:

emerge world | tee /tmp/portage.log

After emerge finished, read the lines starting with '*' and when talking 'bout apache2 you can read something like: "Configuration file changed...now under /usr/..."

When you look at the comments within apache's conf-files, there's sometimes written: "only change if you're master of the known universe". As a "noob" this condition is false and you should never change these settings (even if it's funky to not have everything like others).

To draw a conclusion:

1. you changed a config which had no effect

2. There was an error message in apache's startup log

-> You're wrong (or it's an apache bug)

-> Have a look at some "How To configure apache" (scroll a bit up, the xml-Link)

-> Next time: be aware of emerge messages starting with '*'

-> Read the man pages for "emerge" and "portage"

(You don't have to unmerge packages, portage replaces them automatically or installs concurrent versions if possible [e.g. kernel sources])

----------

## Dr_Dooom33

 *jonnevers wrote:*   

>  *Dr_Dooom33 wrote:*   Im frustrated       
> 
> I'd like to just throw this out there.
> 
> If you are using the most recent version of apache2 in portage your configuration files are in the wrong locations.
> ...

 

emerge --verbose --update --newuse --deep apache subversion mod_php \

> mod_bandwidth mod_layout mod_ldap_userdir mod_loopback mod_mp3 mod_random \

> mod_throttle mod_watch

Calculating dependencies |

!!! All ebuilds that could satisfy "mod_watch" have been masked.

!!! One of the following masked packages is required to complete your request:

- net-www/mod_watch-4.03-r1 (masked by: ~x86 keyword)

- net-www/mod_watch-3.18-r1 (masked by: ~x86 keyword)

- net-www/mod_watch-4.03 (masked by: ~x86 keyword)

- net-www/mod_watch-3.18 (masked by: ~x86 keyword)

For more information, see MASKED PACKAGES section in the emerge man page or 

section 2.2 "Software Availability" in the Gentoo Handbook.

Thats what I got. I cant continue on through the steps at

[url]

http://www.gentoo.org/doc/en/apache-upgrading.xml[/url]

----------

## DNAspark99

try 

```
echo "net-www/mod_watch ~x86" >> /etc/portage/package.keywords
```

----------

## Dr_Dooom33

 *jonnevers wrote:*   

>  *Dr_Dooom33 wrote:*   Im frustrated       
> 
> I'd like to just throw this out there.
> 
> If you are using the most recent version of apache2 in portage your configuration files are in the wrong locations.
> ...

 

/etc/apache2/vhosts/vhosts.conf. 

vhost directory does not exist. Should I make the directory?

----------

## c4

Yes, or you could also adjust your httpd.conf and tell it where your vhosts-configurations files are. The default location for the new apache setup is in /etc/apache2/vhosts/

---------------------------------------------

Here's some slighty offtopic info about what I did when uppgrading to the new layout.

Backup the current apache-configuration files

```
mv /etc/apache2 /etc/apache2_old

mv /etc/conf.d/apache2 /etc/conf.d/apache2_old

emerge apache  (get the latest stable, currently version 2.0.54-r31 in portage for x86)
```

Get apache up and running by setting your servername in the httpd.conf file and then start apache 

```
/etc/init.d/apache2 start
```

If all is ok and apache is serving http-pages ok, than add support for php, ssl, vhost and all other things you need. 

When apache was working ok I copied my old vhost.conf to the new vhost directory and I believe that was it. Add the correct info to your /etc/conf.d/apache2 file and you're all set again.

Some of the php-modules are still being masked as testing, but in such cases 

```
try

echo "net-www/mod_watch ~x86" >> /etc/portage/package.keywords
```

 as DNAspark99 wrote.

----------

## dan2003

I'm pulling my hair out here!! I have previously had vhosts working fine, but since updating after installing the new dev-lang/php y apache vhosts config refuses to work.

I have my home website (which hasnt seen much work recently) and a work site im developing and hostsing on the same box 

I Used to have these all in the one file but since the headcahe began has split it into 2

vhosts.d/home.conf

```

<VirtualHost *:80>

    DocumentRoot /var/www/home.example.com/htdocs

    ServerName home.example.com

    ErrorLog /var/log/apache2/home.example.com-error_log

    CustomLog /var/log/apache2/home.example.com-access_log common

</VirtualHost>

```

vhosts.d/work.conf

```

<VirtualHost *:80>

    ServerName work.example.com

    DocumentRoot /var/www/work.example.com/htdocs

    <Directory "/var/www/work.example.com/htdocs">

          Options None

          AllowOverride None

          Order allow,deny

          Allow from all

    </Directory>

    ErrorLog /var/log/apache2/work.example.com-error_log

    CustomLog /var/log/apache2work.example.com-access_log common

</VirtualHost>

```

Now these two appear too work ok, but my work site has secure area on https or port 443, and this is where the problem has risen.

If i try https://work.example.com i'm treated too

Forbidden

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

Apache Server at ds.homedns.org Port 443

And if i replace the 80 with * in the work.conf,  it goes to the home site!! and if i add a second entry in work.conf with 443 instead of 80 it again goes to the home site.

So my question is, how do i set it u so that https and http will look in /var/www/work.example.com when i goto work.example.com  and goto /var/www/home.example.com when i goto home.example.com ?

----------

## jonnevers

 *dan2003 wrote:*   

> I'm pulling my hair out here!!
> 
> Forbidden
> 
> You don't have permission to access / on this server.
> ...

 

sounds like a permissions problem. the default user used by apache is 'apache'. it is possible that the user 'apache' dosen't have read permission (possibly even execute persmission) on the files for the SSL vhost.

----------

## Monkeh

 *jonnevers wrote:*   

>  *dan2003 wrote:*   I'm pulling my hair out here!!
> 
> Forbidden
> 
> You don't have permission to access / on this server.
> ...

 

Indexes are turned off by default  :Wink: 

Change Options None into Options Indexes.

----------

## dan2003

hehe, sorry giys i dont think either of these are relevant, but thanks anyway. Te file for both hosts are in the same. just certain unctionality in the sripts will refuse to work over a non ssl conection. Also i deliberatly dont want indexing enabled.

https://work.exmaple.com should reveal the same page as http://work.exmaple.com. but for some reason it would would seem it is posinting to /var/www/localhost/htdocs. I have removed -D DEFAULT_HOST from/etc/conf.d/apache so this shouldnt happen as far as i know.

----------

## jonnevers

 *dan2003 wrote:*   

> hehe, sorry giys i dont think either of these are relevant, but thanks anyway. Te file for both hosts are in the same. just certain unctionality in the sripts will refuse to work over a non ssl conection. Also i deliberatly dont want indexing enabled.
> 
> https://work.exmaple.com should reveal the same page as http://work.exmaple.com. but for some reason it would would seem it is posinting to /var/www/localhost/htdocs. I have removed -D DEFAULT_HOST from/etc/conf.d/apache so this shouldnt happen as far as i know.

 

I wouldn't turn indexing on either, it is a bad practice.

I highly doubt there is 'functionality in the scripts' that dosen't work over SSL. SSL is just a transmission protocol.

```
vi /etc/apache2/modules.d/41_mod_ssl.default-vhost.conf

<VirtualHost 68.174.79.31:443>

#  General setup for the virtual host

DocumentRoot "/dir/to/files/secure"

ServerName secure.monkeydisaster.net

ServerAdmin admin@mail.monkeydisaster.net

    <Directory /dir/to/files/secure>

       AllowOverride All

       Order deny,allow

    </Directory>

ErrorLog logs/ssl_error_log

<IfModule mod_log_config.c>

TransferLog logs/ssl_access_log

</IfModule>

```

a version or two back of apache, i had to add the <Directory> tags into the vhost's declarations (for SSL and non-SSL vhosts). That also contributed to me receiving the "do not have permission to view" error.

----------

## Dr_Dooom33

 *DNAspark99 wrote:*   

> if you havn't allready....I recommend upgrading to the newest ebuild, you may as well get whatever 'breakage' you'll encounter over with now, rather than fix this issue only to break it when you eventually DO upgrade... 
> 
> might want to try:
> 
> /etc/conf.d/apache2:
> ...

 

After I add "Include /etc/apache2/vhosts.d/*.conf" as the last line of /etc/apache2/httpd.conf

I get the following when I:

```
/etc/init.d/apache2 start

 * Unable to read configuration file: /etc/apache2/conf/apache2.conf
```

----------

## Dr_Dooom33

 *jonnevers wrote:*   

>  *Dr_Dooom33 wrote:*   Im frustrated       
> 
> I'd like to just throw this out there.
> 
> If you are using the most recent version of apache2 in portage your configuration files are in the wrong locations.
> ...

 

dont you mean 

```

 /etc/apache2/vhosts.d/vhosts.conf

```

----------

## DNAspark99

 *dan2003 wrote:*   

> I'm pulling my hair out here!! I have previously had vhosts working fine, but since updating after installing the new dev-lang/php y apache vhosts config refuses to work.
> 
> I have my home website (which hasnt seen much work recently) and a work site im developing and hostsing on the same box 
> 
> I Used to have these all in the one file but since the headcahe began has split it into 2
> ...

 

shouldn't https have it's own IP specified if you're using SSL? "*:443" may lead to 'issues', maybe not with one vhost but it's bound to have problems with anything more ?

vhosts.d/home.conf

```

NameVirtualHost *:80

<VirtualHost *:80>

    DocumentRoot /var/www/home.example.com/htdocs

    ServerName home.example.com

    ErrorLog /var/log/apache2/home.example.com-error_log

    CustomLog /var/log/apache2/home.example.com-access_log common

</VirtualHost>

```

vhosts.d/work.conf

```

NameVirtualHost 192.168.1.2:80

<VirtualHost *:80>

    ServerName work.example.com

    DocumentRoot /var/www/work.example.com/htdocs

    <Directory "/var/www/work.example.com/htdocs">

          Options None

          AllowOverride None

          Order allow,deny

          Allow from all

    </Directory>

    ErrorLog /var/log/apache2/work.example.com-error_log

    CustomLog /var/log/apache2work.example.com-access_log common

</VirtualHost>

<VirtualHost 192.168.1.2:443>

    ServerName work.example.com

    DocumentRoot /var/www/work.example.com/htdocs

    <Directory "/var/www/work.example.com/htdocs">

          Options None

          AllowOverride None

          Order allow,deny

          Allow from all

    </Directory>

    ErrorLog /var/log/apache2/work.example.com-error_log

    CustomLog /var/log/apache2work.example.com-access_log common

    SSLEngine on

    SSLCertificateKeyFile conf/ssl/work.example.com.key

    SSLCertificateFile conf/ssl/work.example.com.crt

</VirtualHost>

```

----------

## dan2003

Hi again! Thanks that worked..

But i dunno what happened when i did the update but SSL is borked. I can find no errors relating to it in the server logs but firefox compalins that SSL2 is disabled, which it is, but then why isn't apache offereing SSL3 or TLS, which it must have done previously, konq just displays an server error page.

If i enable SSL2 in firefox it then give a message saying unknown error -12281.

I'm approaching  bald!!

----------

## dan2003

Ahhhh, sigh!! fixed it, if i read for a further 5 minutes i wouldn't have made the previous post..

For anybody else with this problem who hasnt found the other post yet  :Wink:  the key to this bit is putting the 

SSLEngine On 

SSLCertificateFile conf/ssl/server.crt 

SSLCertificateKeyFile conf/ssl/server.key 

lines into the vhost section for the relevant hosts.

Time to let my poor brain rest   :Rolling Eyes: 

----------

## Dr_Dooom33

 *jonnevers wrote:*   

>  *Dr_Dooom33 wrote:*   Im frustrated       
> 
> I'd like to just throw this out there.
> 
> If you are using the most recent version of apache2 in portage your configuration files are in the wrong locations.
> ...

 

Okay Im following the apache upgrade instructions

I Try this step

```

Code Listing 2.1: Finding packages to update

$ equery depends net-www/apache

[ Searching for packages depending on net-www/apache... ]

dev-db/phpmyadmin-2.5.6

dev-php/mod_php-4.3.10

dev-php/phpsysinfo-2.1-r2

net-www/mod_bandwidth-2.0.5

net-www/mod_layout-4.0.1a

net-www/mod_ldap_userdir-1.1.4

net-www/mod_loopback-1.04

net-www/mod_mp3-0.40

net-www/mod_random-2.0

net-www/mod_throttle-3.1.2-r1

net-www/mod_watch-3.18

www-apps/viewcvs-0.9.2_p20030430

```

I dont get that at all: I get this:

# equery depends net-www/apache2

bash: equery: command not found 

Finally 

```

(It may be easier to just update world instead of the above)

# emerge --ask --verbose --update --newuse --deep world

```

Is it safe to run emerge world? I might break my system right?

These steps dont work for me:

Check the USE-flags and needed updates)

# emerge --pretend --verbose --update --newuse --deep apache subversion \

mod_php mod_bandwidth mod_layout mod_ldap_userdir mod_loopback mod_mp3 \ 

mod_random mod_throttle mod_watch

(Update the packages)

# emerge --verbose --update --newuse --deep apache subversion mod_php \

mod_bandwidth mod_layout mod_ldap_userdir mod_loopback mod_mp3 mod_random \

mod_throttle mod_watch

----------

## c4

 *Dr_Dooom33 wrote:*   

> I dont get that at all: I get this:
> 
> # equery depends net-www/apache2
> 
> bash: equery: command not found 
> ...

 

From the Gentoo handbook

"You can also list all installed files with the equery tool which is part of the app-portage/gentoolkit package."

 *Dr_Dooom33 wrote:*   

> 
> 
> Finally 
> 
> ```
> ...

 

Running an emerge on all of world is generally safe, I do this task regulary on my servers. Check first with

```
emerge -pvuD world
```

 what portage wants to upgrade. If uncertain, only upgrade the packages that you need and leave the rest for later, that is " emerge -pv package1 package2 package3 "

----------

## Dr_Dooom33

Is there a way I can start all over. I want to just unmerge and start apache2 from scratch. Im following multiple things on this thread.

Its over whelming

PLEASE HELP  :Mad: 

----------

## c4

 *Dr_Dooom33 wrote:*   

> Is there a way I can start all over. I want to just unmerge and start apache2 from scratch. Im following multiple things on this thread.
> 
> Its over whelming
> 
> PLEASE HELP 

 

My advise would be to backup your current Apache directories and othe configuration files, and than simply start over with a new emerge of apache. I hade a little info about this in a previous post.  so, backup current things, emerge a new version of apache and edit the new /etc/apache2/httpd.conf (set your servername to something else than localhost) and than start apache with /etc/init.d/apache2 start.

I would also recommend to start with a plain and simple working apache server, make sure that you can view html pages ok, and than addon additional support for php, ssl and other things needed.

----------

## Dr_Dooom33

Linking a similar thread

https://forums.gentoo.org/viewtopic-t-388058-highlight-apache2.html

----------

## Dr_Dooom33

 *c4 wrote:*   

>  *Dr_Dooom33 wrote:*   Is there a way I can start all over. I want to just unmerge and start apache2 from scratch. Im following multiple things on this thread.
> 
> Its over whelming
> 
> PLEASE HELP  
> ...

 

What directorys do I delete?

How do I back up and why? I never even had a successful conf file.

Im confused about were these files are now

Had 10 people telling me to move things around

would you mind writing a quick howto on how to start over. I will follow it to the letter

I will try to work in the dark until you respond

----------

## DNAspark99

ok, STEP 1: dunno how many things you 'changed' in the process of trying to get them working, but to 'start fresh', do the following to clean up *any* apache cruft that may be left over:

```
mkdir /root/OLDapache && mv /etc/apache* /root/OLDapache/ && rm -f /etc/conf.d/apache* && mv /etc/init.d/apache* /root/OLDapache/ && emerge -C apache mod_php dev-php/php dev-lang/php mod_ssl
```

 -that should clean it up a bit

then, STEP 2: (alter USE flags as needed, ideally put them into /etc/portage/package.use

```
USE="apache ssl" emerge apache dev-lang/php -pv 
```

see what that says. If nothings blocked, no errors, and it looks like your'e able to emerge the packages, go for it.

If all goes well, you should have everything you need and nothing you don't.

report back and let us know how that goes for ya

----------

## c4

OK Dr_Dooom33 and all others ofcourse, I know too well how frustrating things got when Apaches files got moved around, here's something of a quick guide to get you started with apache (no php, no ssl no vhost, just a plain initial setup) :

First backup (move / rename) the current apache directory and configuration files. They're good for checking later, reference etc.

```
mv /etc/apache2 /etc/apache2_old
```

The same for the other important config file, and might as well backup the startup script too.

```
mv /etc/conf.d/apache2 /etc/conf.d/apache2_old

mv /etc/init.d/apache2 /etc/init.d/apache2_old
```

With everything backed up, the next step is to get a clean install of apache, and get a new fresh bunch of standard / default configuration files again.

```
emerge sync && emerge apache
```

 it may not be necessary to sync the portage tree, but this will ensure that your getting the laterst stable version of the Apache webserver for your architecture.

Assuming the install was successful, the first step is to set a proper name for the webserver

```
nano -w /etc/apache2/httpd.conf
```

Use "page down" to the line with ServerName (it's in the top of Section 2: 'Main' server configuration) or use the search function in nano, ctrl w and search for servername.

Set this to your servers dns-name, or just use the hostname of the box

```
In your httpd.conf, set your servername

ServerName tux.com
```

Test and see if Apache is working by starting the server and viewing the apache testpage.

```
/etc/init.d/apache2 start
```

Open upp your favorite browser and check http://tux.com  , http://localhost/  or whatever the address is to your server.

Good luck!

----------

## Dr_Dooom33

Still frustrated with APache serevr pleease help if you know anything

----------

## Dr_Dooom33

Giving up.

Is there a HOW-To on how to start apache2 installation from scratch?

----------

## xante

 *Monkeh wrote:*   

> 
> 
> Indexes are turned off by default 
> 
> Change Options None into Options Indexes.

 

Man Monkeh you are a life saver, ive been tearing at myself trying to figure out why ssl wasnt working...when in reality it was me not working.

----------

## thinkdifferent

hello,

Can u tell me if my Vhost config is ok or not... because it doesnt work...

 *Quote:*   

> 
> 
> NameVirtualHost 82.237.227.101
> 
> <VirtualHost 82.237.227.101>
> ...

 

thanks a lot in advance,

my head is blowing away....

----------

## Diesel_Fuel

Dr. Doom if I may just throw in my 2 cents why don't you give Apache 1.3.33 a shot?  I have it working fine, I've used with and without virtual hosts.  Unless you have a real "need" for Apache 2 then I'd suggest giving 1.3 a try.

----------

## c4

 *thinkdifferent wrote:*   

> hello,
> 
> Can u tell me if my Vhost config is ok or not... because it doesnt work...
> 
> 

 

Hi

Perhaps trying something like this might work:

In my httpd.conf I have stated a 'primary' virtual host, a default vhost that everything else not otherwise specified is used. Than I have a seperat vhost-file located in /etc/apache2/vhosts.d/vhosts.conf

from my httpd.conf

```
NameVirtualHost *:80

<VirtualHost *:80>

ServerName foobar.com 

ServerAlias foobar.com *.foobar.com 

    DocumentRoot "/www/foobar.com"

    <Directory "/www/foobar.com">

        AllowOverride None

        Order allow,deny

        Allow from all

    </Directory>

</VirtualHost>

#

# Gentoo VHosts

# 

# For Gentoo we include External Virtual Hosts Files.

#

Include conf/vhosts.d/vhosts.conf

```

and the included file for my virtual hosts:

```

#################################################

<VirtualHost *:80>

ServerName vhostdomain.ath.cx

ServerAlias vhostdomain.ath.cx

DocumentRoot /home/foobar/htdocs

   <Directory "/home/foobar/htdocs">

     allow from all

    </Directory>

  </VirtualHost>

#################################################

<VirtualHost *:80>

ServerName another_vhost.org

ServerAlias another_vhost.org *.another_vhost.org

DocumentRoot /www/another_vhost.org

   <Directory "/www/another_vhost.org">

     allow from all

   </Directory>

</VirtualHost>

#################################################

```

Adjust your paths to match your vhosts and configfiles. Restart or reload apache after makeing your changes to your configuration files, and that should be about all.

----------

## thinkdifferent

Ok thanks a lot, my main domaine works  :Smile: 

But i ve an other question,

i want to do a subdomain of mine (which is XX.XX.com), 

something like tools.XX.XX.com

How do i do that ?

With Apache Vhost and Bind ?

because i installed bind, i tryed to configure it but i m note sure of what i did,

so could somone explain me how to do a subdomain...

thanks a lot..

----------

## Diesel_Fuel

I'm on Apache 1.3, but I'd imagine it'd be close to the same process.  The first thing that took me a while to figure out how to do is add the subdomain to your DNS server.  If you don't do this, it won't work.  So if you're domain is foo.com and and you want to have the subdomain woot, then be sure to a woot.foo.com to your DNS records.

For the virtualhost, its pretty simple.

<VirtualHost *:80>

ServerName woot.foo.com

ServerAlias *.woot.foo.com

</VirtualHost>

Of course you would need the document root, etc, but that's the basic part.

----------

## thinkdifferent

ok tks...

so i ve to study again my bind conf  :Wink: 

----------

## forrie

Hi all, 

I've followed this thread to see if I can resolve my own problem with apache-2.0 and VirtualHosts (IP based), and no luck.

Here's the config...

My host has several IP aliases assigned, and the configuration is very simple:

httpd.conf (some basic elements):

ServerName 127.0.0.1

DocumentRoot "/var/www/html"

Listen 80

Include vhost.conf.server

Include vhost.conf.server1

Include vhost.conf.server2

server, server1 and server2 each have different IPs.

We need to use this because we have other users coming in via an SSH tunnel, where they specify the IP address:port to connect to.  Kludgey, but it works for some debugging.

Anyway...

The other virtualhost I have is configured like this:

<VirtualHost 192.168.200.172:80>

  ServerName server2.domain.net

  DocumentRoot /var/www/server2/htdocs (exists, correct permissions)

  <Directory /var/www/server2/htdocs>

    AllowOverride Options AuthConfig

# some php_flag and php_value figures here

    <Limit GET POST OPTIONS PROPFIND>

      Order allow,deny

      Allow from all

    </Limit> 

  </Directory>

</VirtualHost>

The problem...

My first host works fine.  The second host works, and is on a separate IP address as well... though the code it works with is tied in somehow to the first one. (php)

The third one I mentioned above is just not working at all... instead, it goes to /var/www/html (!).

I've double checked the paths, the vhost.conf.server3 and DocumentRoot, everything.  I'm stumped.

The <VirtualHost  x.x.x.x:80> are all correct... each has it's own ip address and the ip's are listed in ifconfig, they're up and connectable.  If I go to server3's IP, I still get the default page from /var/www/html.

So, I'm wondering if I just did this wrong (well, obviously I did).

Anyone have any clues as to where I may have missed something.

Thanks.

----------

## paul7v7

Sorry to bring up an old topic.  However I am having MAJOR issues with my apache.  I recently "upgraded" and now i have lost everything.   have gone through all the threads and it has just confused me so much.  Basically the old version i had used /etc/apache2/conf/vhosts/vhost.conf for my virtual host and used /etc/apache2/conf/apache2.conf for the config.  I was runnign php and mysql.  I updated all but now all I am getting is a lot of page not found and some default pages (ones i set).  PLEASE NOTE reference to website.org in my files below is just FYI it isn't what my site is called.  My conf.d/apache contains the line APACHE2_OPTS="-D PHP5 -D DEFAULT_VHOST"

below is my httpd.conf file

```
ServerRoot "/usr/lib/apache2"

#

# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.

#

#LockFile "/var/run/apache2.lock"

#

# ScoreBoardFile: File used to store internal server process information.

# If unspecified (the default), the scoreboard will be stored in an

# anonymous shared memory segment, and will be unavailable to third-party

# applications.

# If specified, ensure that no two invocations of Apache share the same

# scoreboard file. The scoreboard file MUST BE STORED ON A LOCAL DISK.

#

<IfModule !perchild.c>

    #ScoreBoardFile /var/run/apache2_runtime_status

</IfModule>

#

# PidFile: The file in which the server should record its process

# identification number when it starts.

#

PidFile "/var/run/apache2.pid"

#

# Timeout: The number of seconds before receives and sends time out.

#

Timeout 300

#

# KeepAlive: Whether or not to allow persistent connections (more than

# one request per connection). Set to "Off" to deactivate.

#

KeepAlive On

#

# MaxKeepAliveRequests: The maximum number of requests to allow

# during a persistent connection. Set to 0 to allow an unlimited amount.

# We recommend you leave this number high, for maximum performance.

#

MaxKeepAliveRequests 100

#

# KeepAliveTimeout: Number of seconds to wait for the next request from the

# same client on the same connection.

#

KeepAliveTimeout 15

##

## Server-Pool Size Regulation (MPM specific)

## 

# prefork MPM [DEFAULT IF USE=-threads]

# StartServers: number of server processes to start

# MinSpareServers: minimum number of server processes which are kept spare

# MaxSpareServers: maximum number of server processes which are kept spare

# MaxClients: maximum number of server processes allowed to start

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule prefork.c>

    StartServers         5

    MinSpareServers      5

    MaxSpareServers     10

    MaxClients         150

    MaxRequestsPerChild  0

</IfModule>

# worker MPM [DEFAULT IF USE=threads]

# StartServers: initial number of server processes to start

# MaxClients: maximum number of simultaneous client connections

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# ThreadsPerChild: constant number of worker threads in each server process

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule worker.c>

    StartServers         2

    MaxClients         150

    MinSpareThreads     25

    MaxSpareThreads     75 

    ThreadsPerChild     25

    MaxRequestsPerChild  0

</IfModule>

# perchild MPM [THIS MPM IS NOT SUPPORTED]

# NumServers: constant number of server processes

# StartThreads: initial number of worker threads in each server process

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# MaxThreadsPerChild: maximum number of worker threads in each server process

# MaxRequestsPerChild: maximum number of connections per server process

<IfModule perchild.c>

    NumServers           5

    StartThreads         5

    MinSpareThreads      5

    MaxSpareThreads     10

    MaxThreadsPerChild  20

    MaxRequestsPerChild  0

</IfModule>

# peruser MPM [THIS MPM IS NOT SUPPORTED]

# MinSpareServers - Minimum number of idle children, to handle request spikes 

# MaxClients - Maximum number of children alive at the same time 

# MaxProcessors - Maximum number of processors per vhost

# Multiplexer - Specify an Multiplexer Child configuration.

# Processor - Specify a User and Group for a specific child process.

# ServerEnvironment - Specify the server environment for this virtual host.

<IfModule peruser.c>

    ServerLimit          256

    MaxClients           256

    MinSpareProcessors     2

    MaxProcessors         10

    MaxRequestsPerChild 1000

    

    # kill off idle processors after this many seconds

    # set to 0 to disable

    ExpireTimeout       1800

    

    Multiplexer nobody nobody

    

    Processor apache apache

    

    # chroot dir is optional:

    # Processor user group /path/to/chroot

</IfModule>

# itk MPM [THIS MPM IS NOT SUPPORTED]

# StartServers: number of server processes to start

# MinSpareServers: minimum number of server processes which are kept spare

# MaxSpareServers: maximum number of server processes which are kept spare

# MaxClients: maximum number of server processes allowed to start

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule itk.c>

    StartServers           5

    MinSpareServers        2

    MaxSpareServers       10

    MaxClients           150

    MaxRequestsPerChild 1000

</IfModule>

#

# Listen: Allows you to bind Apache to specific IP addresses and/or

# ports, instead of the default. See also the <VirtualHost>

# directive.

#

# Change this to Listen on specific IP addresses as shown below to 

# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)

#

#Listen 12.34.56.78:80

Listen 80

#

# Dynamic Shared Object (DSO) Support

#

# To be able to use the functionality of a module which was built as a DSO you

# have to place corresponding `LoadModule' lines at this location so the

# directives contained in it are actually available _before_ they are used.

# Statically compiled modules (those listed by `httpd -l') do not need

# to be loaded here.

#

# The following modules are considered as the default configuration.

# If you wish to disable one of them, you may have to alter other 

# configuration directives.

#

# You should always leave these three, as they are needed for normal use.

# mod_access (Order, Allow, etc..)

# mod_log_config (Transferlog, etc..)

# mod_mime (AddType, etc...)

#

# Example:

# LoadModule foo_module modules/mod_foo.so

# Authentication Modules

#

# These modules provide authentication and authorization for

# clients. They should not normally be disabled.

#

LoadModule access_module                 modules/mod_access.so

LoadModule auth_module                   modules/mod_auth.so

LoadModule auth_anon_module              modules/mod_auth_anon.so

LoadModule auth_dbm_module               modules/mod_auth_dbm.so

LoadModule auth_digest_module            modules/mod_auth_digest.so

#

# Metadata Modules

# 

# These modules provide extra data to clients about

# a file, such as the mime-type or charset.

#

LoadModule charset_lite_module           modules/mod_charset_lite.so

LoadModule env_module                    modules/mod_env.so

LoadModule expires_module                modules/mod_expires.so

LoadModule headers_module                modules/mod_headers.so

LoadModule mime_module                   modules/mod_mime.so

LoadModule negotiation_module            modules/mod_negotiation.so

LoadModule setenvif_module               modules/mod_setenvif.so

#

# Logging Modules

# 

# These modules provide logging services for Apache

#

LoadModule log_config_module             modules/mod_log_config.so

LoadModule logio_module                  modules/mod_logio.so

#

# CGI Modules

#

# These modules provide the ability to execute CGI Scripts.

#

LoadModule cgi_module                    modules/mod_cgi.so

LoadModule cgid_module                   modules/mod_cgid.so

#

# This `suexec` module provides the ability to exeucte CGI scripts under

# a different user than apache is run.

#

LoadModule suexec_module                 modules/mod_suexec.so

#

# Mappers

#

# These Modules provide URL mappings or translations.

LoadModule alias_module                  modules/mod_alias.so

LoadModule rewrite_module                modules/mod_rewrite.so

<IfDefine USERDIR>

    LoadModule userdir_module            modules/mod_userdir.so

</IfDefine>

#

# Handlers

#

# These modules create content for a client.

#

<IfDefine INFO>

    LoadModule info_module               modules/mod_info.so

    LoadModule status_module             modules/mod_status.so

</IfDefine>

LoadModule actions_module                modules/mod_actions.so

LoadModule autoindex_module              modules/mod_autoindex.so

LoadModule dir_module                    modules/mod_dir.so

#

# Filters

#

# These modules provide filters for Apache.

# They preform common tasks like gzip encoding or SSI

#

#

LoadModule ext_filter_module             modules/mod_ext_filter.so

LoadModule deflate_module                modules/mod_deflate.so

LoadModule include_module                modules/mod_include.so

#

# Cache Modules

#

# The following modules are used for storing a cache of

# generated or proxied content.

#

#LoadModule cache_module                  modules/mod_cache.so

#LoadModule disk_cache_module             modules/mod_disk_cache.so

#LoadModule mem_cache_module              modules/mod_mem_cache.so

#LoadModule file_cache_module             modules/mod_file_cache.so

#

# Proxy Modules

# 

# The following modules are only needed if you are running

# Apache as a Forward or Reverse Proxy.

# 

# WARNING: Enabling these modules can be dangerous! 

#   READ THE DOCUMENTATION FIRST:

#   http://httpd.apache.org/docs/2.0/mod/mod_proxy.html

<IfDefine PROXY>

    LoadModule proxy_module                  modules/mod_proxy.so

    LoadModule proxy_connect_module          modules/mod_proxy_connect.so

    LoadModule proxy_ftp_module              modules/mod_proxy_ftp.so

    LoadModule proxy_http_module             modules/mod_proxy_http.so

</IfDefine>

#

# Uncommon Modules

#

# The following Modules are not commonly loaded for Apache

#

#LoadModule case_filter_module            modules/mod_case_filter.so

#LoadModule case_filter_in_module         modules/mod_case_filter_in.so

#LoadModule echo_module                   modules/mod_echo.so

#LoadModule mime_magic_module             modules/mod_mime_magic.so

#LoadModule speling_module                modules/mod_speling.so

#LoadModule unique_id_module              modules/mod_unique_id.so

#LoadModule vhost_alias_module            modules/mod_vhost_alias.so

#

# Obsolete Modules

# 

# The Following modules are not commonly needed and use 

# obsolete technologies.

#

#LoadModule cern_meta_module              modules/mod_cern_meta.so

#LoadModule imap_module                   modules/mod_imap.so

#LoadModule usertrack_module              modules/mod_usertrack.so

#LoadModule asis_module                   modules/mod_asis.so

#

# Extra Modules

#

# We Include extra .conf files from /etc/apache2/modules.d

# This is used to load things like PHP and mod_ssl.

#

Include /etc/apache2/modules.d/*.conf

### Section 2: 'Main' server configuration

#

# The directives in this section set up the values used by the 'main'

# server, which responds to any requests that aren't handled by a

# <VirtualHost> definition.  These values also provide defaults for

# any <VirtualHost> containers you may define later in the file.

#

# All of these directives may appear inside <VirtualHost> containers,

# in which case these default settings will be overridden for the

# virtual host being defined.

#

#

# If you wish httpd to run as a different user or group, you must run

# httpd as root initially and it will switch.  

#

# User/Group: The name (or #number) of the user/group to run httpd as.

#  . On SCO (ODT 3) use "User nouser" and "Group nogroup".

#  . On HPUX you may not be able to use shared memory as nobody, and the

#    suggested workaround is to create a user www and use that user.

#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)

#  when the value of (unsigned)Group is above 60000; 

#  don't use Group #-1 on these systems!

#

User apache

Group apache

#

# ServerAdmin: Your address, where problems with the server should be

# e-mailed.  This address appears on some server-generated pages, such

# as error documents.  e.g. admin@your-domain.com

#

ServerAdmin root@localhost

#

# ServerName gives the name and port that the server uses to identify itself.

# This can often be determined automatically, but we recommend you specify

# it explicitly to prevent problems during startup.

#

# If this is not set to valid DNS name for your host, server-generated

# redirections will not work.  See also the UseCanonicalName directive.

#

# If your host doesn't have a registered DNS name, enter its IP address here.

# You will have to access it by its address anyway, and this will make 

# redirections work in a sensible way.

#

ServerName website.org

#

# UseCanonicalName: Determines how Apache constructs self-referencing 

# URLs and the SERVER_NAME and SERVER_PORT variables.

# When set "Off", Apache will use the Hostname and Port supplied

# by the client.  When set "On", Apache will use the value of the

# ServerName directive.

#

UseCanonicalName Off

#

# Each directory to which Apache has access can be configured with respect

# to which services and features are allowed and/or disabled in that

# directory (and its subdirectories). 

#

# First, we configure the "default" to be a very restrictive set of 

# features.  

#

#<Directory />

#    Options FollowSymLinks

#    AllowOverride None

#</Directory>

DirectoryIndex index.php

<Directory /mnt/website/forum>

Options ExecCGI FollowSymLinks Includes IncludesNOEXEC +Indexes MultiViews

AllowOverride none

Order allow,deny

Allow from all

</Directory>

#

# Note that from this point forward you must specifically allow

# particular features to be enabled - so if something's not working as

# you might expect, make sure that you have specifically enabled it

# below.

#

#

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

# directory if a ~user request is received.

# enable by adding -D USERDIR to /etc/conf.d/apache2

#

<IfModule mod_userdir.c>

    UserDir public_html

#

# Control access to UserDir directories.  The following is an example

# for a site where these directories are restricted to read-only.

#

    <Directory /home/*/public_html>

        AllowOverride FileInfo AuthConfig Limit Indexes

        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>

# Enable this additional section if you would like to make use of a

# suexec-enabled cgi-bin directory on a per-user basis.

#

#<Directory /home/*/public_html/cgi-bin>

#    Options ExecCGI

#    SetHandler cgi-script

#</Directory>

</IfModule>

#

# DirectoryIndex: sets the file that Apache will serve if a directory

# is requested.

#

# The index.html.var file (a type-map) is used to deliver content-

# negotiated documents.  The MultiViews Option can be used for the 

# same purpose, but it is much slower.

#

DirectoryIndex index.html index.html.var index.php

#

# AccessFileName: The name of the file to look for in each directory

# for additional configuration directives.  See also the AllowOverride 

# directive.

#

AccessFileName .htaccess

#

# The following lines prevent .htaccess and .htpasswd files from being 

# viewed by Web clients. 

#

<FilesMatch "^\.ht">

    Order allow,deny

    Deny from all

</FilesMatch>

#

# TypesConfig describes where the mime.types file (or equivalent) is

# to be found.

#

TypesConfig /etc/mime.types

#

# DefaultType is the default MIME type the server will use for a document

# if it cannot otherwise determine one, such as from filename extensions.

# If your server contains mostly text or HTML documents, "text/plain" is

# a good value.  If most of your content is binary, such as applications

# or images, you may want to use "application/octet-stream" instead to

# keep browsers from trying to display binary files as though they are

# text.

#

DefaultType text/plain

#

# The mod_mime_magic module allows the server to use various hints from the

# contents of the file itself to determine its type.  The MIMEMagicFile

# directive tells the module where the hint definitions are located.

#

<IfModule mod_mime_magic.c>

    MIMEMagicFile /etc/apache2/magic

</IfModule>

#

# HostnameLookups: Log the names of clients or just their IP addresses

# e.g., www.apache.org (on) or 204.62.129.132 (off).

# The default is off because it'd be overall better for the net if people

# had to knowingly turn this feature on, since enabling it means that

# each client request will result in AT LEAST one lookup request to the

# nameserver.

#

HostnameLookups Off

#

# EnableMMAP: Control whether memory-mapping is used to deliver

# files (assuming that the underlying OS supports it).

# The default is on; turn this off if you serve from NFS-mounted 

# filesystems.  On some systems, turning it off (regardless of

# filesystem) can improve performance; for details, please see

# http://httpd.apache.org/docs/2.0/mod/core.html#enablemmap

#

#EnableMMAP off

#

# EnableSendfile: Control whether the sendfile kernel support is 

# used  to deliver files (assuming that the OS supports it).

# The default is on; turn this off if you serve from NFS-mounted 

# filesystems.  Please see

# http://httpd.apache.org/docs/2.0/mod/core.html#enablesendfile

#

#EnableSendfile off

#

# ErrorLog: The location of the error log file.

# If you do not specify an ErrorLog directive within a <VirtualHost>

# container, error messages relating to that virtual host will be

# logged here.  If you *do* define an error logfile for a <VirtualHost>

# container, that host's errors will be logged there and not here.

#

ErrorLog logs/error_log

#

# LogLevel: Control the number of messages logged to the error_log.

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

#

LogLevel warn

#

# The following directives define some format nicknames for use with

# a CustomLog directive (see below).

#

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

LogFormat "%v %h %l %u %t \"%r\" %>s %b %T" script

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" VLOG=%{VLOG}e" vhost

# You need to enable mod_logio.c to use %I and %O

#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

#

# The location and format of the access logfile (Common Logfile Format).

# If you do not define any access logfiles within a <VirtualHost>

# container, they will be logged here.  Contrariwise, if you *do*

# define per-<VirtualHost> access logfiles, transactions will be

# logged therein and *not* in this file.

#

CustomLog logs/access_log common

#

# If you would like to have agent and referer logfiles, uncomment the

# following directives.

#

#CustomLog logs/referer_log referer

#CustomLog logs/agent_log agent

#

# If you prefer a single logfile with access, agent, and referer information

# (Combined Logfile Format) you can use the following directive.

#

#CustomLog logs/access_log combined

#

# ServerTokens

# This directive configures what you return as the Server HTTP response

# Header. The default is 'Full' which sends information about the OS-Type

# and compiled in modules.

# Set to one of:  Full | OS | Minor | Minimal | Major | Prod

# where Full conveys the most information, and Prod the least.

#

ServerTokens Prod

#

# Optionally add a line containing the server version and virtual host

# name to server-generated pages (internal error documents, FTP directory 

# listings, mod_status and mod_info output etc., but not CGI generated 

# documents or custom error documents).

# Set to "EMail" to also include a mailto: link to the ServerAdmin.

# Set to one of:  On | Off | EMail

#

ServerSignature On

#

# Aliases: Add here as many aliases as you need (with no limit). The format is 

# Alias fakename realname

#

# Note that if you include a trailing / on fakename then the server will

# require it to be present in the URL.  So "/icons" isn't aliased in this

# example, only "/icons/".  If the fakename is slash-terminated, then the 

# realname must also be slash terminated, and if the fakename omits the 

# trailing slash, the realname must also omit it.

#

# We include the /icons/ alias for FancyIndexed directory listings.  If you

# do not use FancyIndexing, you may comment this out.

#

Alias /icons/ "/var/www/localhost/icons/"

<Directory "/var/www/localhost/icons/">

    Options Indexes MultiViews

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

#

# ScriptAlias: This controls which directories contain server scripts.

# ScriptAliases are essentially the same as Aliases, except that

# documents in the realname directory are treated as applications and

# run by the server when requested rather than as documents sent to the client.

# The same rules about trailing "/" apply to ScriptAlias directives as to

# Alias.

#

ScriptAlias /cgi-bin/ /var/www/localhost/cgi-bin/

<IfModule mod_cgid.c>

    #

    # Additional to mod_cgid.c settings, mod_cgid has Scriptsock <path>

    # for setting UNIX socket for communicating with cgid.

    #

    #Scriptsock            /var/run/cgisock

</IfModule>

#

# "/var/www/localhost/cgi-bin/" should be changed to whatever your ScriptAliased

# CGI directory exists, if you have that configured.

#

<Directory "/var/www/localhost/cgi-bin/">

    AllowOverride None

    Options None

    Order allow,deny

    Allow from all

</Directory>

#

# Redirect allows you to tell clients about documents which used to exist in

# your server's namespace, but do not anymore. This allows you to tell the

# clients where to look for the relocated document.

# Example:

# Redirect permanent /foo http://www.example.com/bar

#

# Directives controlling the display of server-generated directory listings.

#

<IfModule mod_autoindex.c>

    #

    # IndexOptions: Controls the appearance of server-generated directory

    # listings.

    #

    IndexOptions FancyIndexing VersionSort

    #

    # AddIcon* directives tell the server which icon to show for different

    # files or filename extensions.  These are only displayed for

    # FancyIndexed directories.

    #

    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

    AddIconByType (TXT,/icons/text.gif) text/*

    AddIconByType (IMG,/icons/image2.gif) image/*

    AddIconByType (SND,/icons/sound2.gif) audio/*

    AddIconByType (VID,/icons/movie.gif) video/*

    AddIcon /icons/binary.gif .bin .exe

    AddIcon /icons/binhex.gif .hqx

    AddIcon /icons/tar.gif .tar

    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv

    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip

    AddIcon /icons/a.gif .ps .ai .eps

    AddIcon /icons/layout.gif .html .shtml .htm .pdf

    AddIcon /icons/text.gif .txt

    AddIcon /icons/c.gif .c

    AddIcon /icons/p.gif .pl .py

    AddIcon /icons/f.gif .for

    AddIcon /icons/dvi.gif .dvi

    AddIcon /icons/uuencoded.gif .uu

    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl

    AddIcon /icons/tex.gif .tex

    AddIcon /icons/bomb.gif core

    AddIcon /icons/back.gif ..

    AddIcon /icons/hand.right.gif README

    AddIcon /icons/folder.gif ^^DIRECTORY^^

    AddIcon /icons/blank.gif ^^BLANKICON^^

    #

    # DefaultIcon is which icon to show for files which do not have an icon

    # explicitly set.

    #

    DefaultIcon /icons/unknown.gif

    #

    # AddDescription allows you to place a short description after a file in

    # server-generated indexes.  These are only displayed for FancyIndexed

    # directories.

    # Format: AddDescription "description" filename

    #

    #AddDescription "GZIP compressed document" .gz

    #AddDescription "tar archive" .tar

    #AddDescription "GZIP compressed tar archive" .tgz

    #

    # ReadmeName is the name of the README file the server will look for by

    # default, and append to directory listings.

    #

    # HeaderName is the name of a file which should be prepended to

    # directory indexes. 

    ReadmeName README.html

    HeaderName HEADER.html

    #

    # IndexIgnore is a set of filenames which directory indexing should ignore

    # and not include in the listing.  Shell-style wildcarding is permitted.

    #

    IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t .svn

</IfModule>

#

# DefaultLanguage and AddLanguage allows you to specify the language of 

# a document. You can then use content negotiation to give a browser a 

# file in a language the user can understand.

#

# Specify a default language. This means that all data

# going out without a specific language tag (see below) will 

# be marked with this one. You probably do NOT want to set

# this unless you are sure it is correct for all cases.

#

# * It is generally better to not mark a page as 

# * being a certain language than marking it with the wrong

# * language!

#

# DefaultLanguage nl

#

# Note 1: The suffix does not have to be the same as the language

# keyword --- those with documents in Polish (whose net-standard

# language code is pl) may wish to use "AddLanguage pl .po" to

# avoid the ambiguity with the common suffix for perl scripts.

#

# Note 2: The example entries below illustrate that in some cases 

# the two character 'Language' abbreviation is not identical to 

# the two character 'Country' code for its country,

# E.g. 'Danmark/dk' versus 'Danish/da'.

#

# Note 3: In the case of 'ltz' we violate the RFC by using a three char

# specifier. There is 'work in progress' to fix this and get

# the reference data for rfc1766 cleaned up.

#

# Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)

# English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)

# Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)

# Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)

# Norwegian (no) - Polish (pl) - Portugese (pt)

# Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)

# Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)

#

AddLanguage ca .ca

AddLanguage cs .cz .cs

AddLanguage da .dk

AddLanguage de .de

AddLanguage el .el

AddLanguage en .en

AddLanguage eo .eo

AddLanguage es .es

AddLanguage et .et

AddLanguage fr .fr

AddLanguage he .he

AddLanguage hr .hr

AddLanguage it .it

AddLanguage ja .ja

AddLanguage ko .ko

AddLanguage ltz .ltz

AddLanguage nl .nl

AddLanguage nn .nn

AddLanguage no .no

AddLanguage pl .po

AddLanguage pt .pt

AddLanguage pt-BR .pt-br

AddLanguage ru .ru

AddLanguage sv .sv

AddLanguage zh-CN .zh-cn

AddLanguage zh-TW .zh-tw

#

# LanguagePriority allows you to give precedence to some languages

# in case of a tie during content negotiation.

#

# Just list the languages in decreasing order of preference. We have

# more or less alphabetized them here. You probably want to change this.

#

LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

#

# ForceLanguagePriority allows you to serve a result page rather than

# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)

# [in case no accepted languages matched the available variants]

#

ForceLanguagePriority Prefer Fallback

#

# Commonly used filename extensions to character sets. You probably

# want to avoid clashes with the language extensions, unless you

# are good at carefully testing your setup after each change.

# See http://www.iana.org/assignments/character-sets for the

# official list of charset names and their respective RFCs.

#

AddCharset ISO-8859-1  .iso8859-1  .latin1

AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen

AddCharset ISO-8859-3  .iso8859-3  .latin3

AddCharset ISO-8859-4  .iso8859-4  .latin4

AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru

AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb

AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk

AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb

AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk

AddCharset ISO-2022-JP .iso2022-jp .jis

AddCharset ISO-2022-KR .iso2022-kr .kis

AddCharset ISO-2022-CN .iso2022-cn .cis

AddCharset Big5        .Big5       .big5

# For russian, more than one charset is used (depends on client, mostly):

AddCharset WINDOWS-1251 .cp-1251   .win-1251

AddCharset CP866       .cp866

AddCharset KOI8-r      .koi8-r .koi8-ru

AddCharset KOI8-ru     .koi8-uk .ua

AddCharset ISO-10646-UCS-2 .ucs2

AddCharset ISO-10646-UCS-4 .ucs4

AddCharset UTF-8       .utf8

# The set below does not map to a specific (iso) standard

# but works on a fairly wide range of browsers. Note that

# capitalization actually matters (it should not, but it

# does for some browsers).

#

# See http://www.iana.org/assignments/character-sets

# for a list of sorts. But browsers support few.

#

AddCharset GB2312      .gb2312 .gb 

AddCharset utf-7       .utf7

AddCharset utf-8       .utf8

AddCharset big5        .big5 .b5

AddCharset EUC-TW      .euc-tw

AddCharset EUC-JP      .euc-jp

AddCharset EUC-KR      .euc-kr

AddCharset shift_jis   .sjis

#

# AddType allows you to add to or override the MIME configuration

# file mime.types for specific file types.

#

#AddType application/x-tar .tgz

#

# AddEncoding allows you to have certain browsers uncompress

# information on the fly. Note: Not all browsers support this.

# Despite the name similarity, the following Add* directives have nothing

# to do with the FancyIndexing customization directives above.

#

#AddEncoding x-compress .Z

#AddEncoding x-gzip .gz .tgz

#

# If the AddEncoding directives above are commented-out, then you

# probably should define those extensions to indicate media types:

#

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

#

# AddHandler allows you to map certain file extensions to "handlers":

# actions unrelated to filetype. These can be either built into the server

# or added with the Action directive (see below)

#

# To use CGI scripts outside of ScriptAliased directories:

# (You will also need to add "ExecCGI" to the "Options" directive.)

#

#AddHandler cgi-script .cgi

#

# For files that include their own HTTP headers:

#

#AddHandler send-as-is asis

#

# For server-parsed imagemap files:

#

#AddHandler imap-file map

#

# For type maps (negotiated resources):

# (This is enabled by default to allow the Apache "It Worked" page

#  to be distributed in multiple languages.)

#

AddHandler type-map var

#

# Filters allow you to process content before it is sent to the client.

#

# To parse .shtml files for server-side includes (SSI):

# (You will also need to add "Includes" to the "Options" directive.)

#

#AddType text/html .shtml

#AddOutputFilter INCLUDES .shtml

#

# Action lets you define media types that will execute a script whenever

# a matching file is called. This eliminates the need for repeated URL

# pathnames for oft-used CGI file processors.

# Format: Action media/type /cgi-script/location

# Format: Action handler-name /cgi-script/location

#

#

# Customizable error responses come in three flavors:

# 1) plain text 2) local redirects 3) external redirects

#

# Some examples:

#ErrorDocument 500 "The server made a boo boo."

#ErrorDocument 404 /missing.html

#ErrorDocument 404 "/cgi-bin/missing_handler.pl"

#ErrorDocument 402 http://www.example.com/subscription_info.html

#

#

# Putting this all together, we can internationalize error responses.

#

# We use Alias to redirect any /error/HTTP_<error>.html.var response to

# our collection of by-error message multi-language collections.  We use 

# includes to substitute the appropriate text.

#

# You can modify the messages' appearance without changing any of the

# default HTTP_<error>.html.var files by adding the line:

#

#   Alias /error/include/ "/your/include/path/"

#

# which allows you to create your own set of files by starting with the

# /var/www/localhost/error/include files and copying them to /your/includepath/ 

# even on a per-VirtualHost basis.  The default include files will display

# your Apache version number and your ServerAdmin email address regardless

# of the setting of ServerSignature.

#

# The internationalized error documents require mod_alias, mod_include

# and mod_negotiation.  To activate them, uncomment the following 30 lines.

#    Alias /error/ "/var/www/localhost/error/"

#

#    <Directory "/var/www/localhost/error">

#        AllowOverride None

#        Options IncludesNoExec

#        AddOutputFilter Includes html

#        AddHandler type-map var

#        Order allow,deny

#        Allow from all

#        LanguagePriority en cs de es fr it nl sv pt-br ro

#        ForceLanguagePriority Prefer Fallback

#    </Directory>

#

#    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var

#    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var

#    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var

#    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var

#    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var

#    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

#    ErrorDocument 410 /error/HTTP_GONE.html.var

#    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var

#    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var

#    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var

#    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var

#    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var

#    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var

#    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var

#    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var

#    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var

#    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

#

# The following directives modify normal HTTP response behavior to

# handle known problems with browser implementations.

#

BrowserMatch "Mozilla/2" nokeepalive

BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

BrowserMatch "RealPlayer 4\.0" force-response-1.0

BrowserMatch "Java/1\.0" force-response-1.0

BrowserMatch "JDK/1\.0" force-response-1.0

#

# The following directive disables redirects on non-GET requests for

# a directory that does not include the trailing slash.  This fixes a 

# problem with Microsoft WebFolders which does not appropriately handle 

# redirects for folders with DAV methods.

# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.

#

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully

BrowserMatch "MS FrontPage" redirect-carefully

BrowserMatch "^WebDrive" redirect-carefully

BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully

BrowserMatch "^gnome-vfs" redirect-carefully

BrowserMatch "^XML Spy" redirect-carefully

BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

#

# Allow server status reports generated by mod_status,

# with the URL of http://servername/server-status

# Change the ".example.com" to match your domain to enable.

#

<IfDefine INFO>

    ExtendedStatus On

    <Location /server-status>

        SetHandler server-status

        Order deny,allow

        Deny from all

        Allow from localhost

    </Location>

</IfDefine>

#

# Allow remote server configuration reports, with the URL of

#  http://localhost/server-info (This is useful for debugging)

#

<IfDefine INFO>

    <Location /server-info>

       SetHandler server-info

       Order deny,allow

       Deny from all

       Allow from localhost

    </Location>

</IfDefine>

#

# Gentoo VHosts

# 

# For Gentoo we include External Virtual Hosts Files.

# Please see vhosts.d/00_default_vhost.conf for the default virtual host.

#

Include /etc/apache2/vhosts.d/*.conf

```

below here is my contents of my vhosts.conf

```
################# Named VirtualHosts

#NameVirtualHost 111.222.33.44

#<VirtualHost 111.222.33.44>

#ServerName www.domain.tld

#ServerPath /domain

#DocumentRoot /web/domain

#</VirtualHost>

#DirectoryIndex index.php

# <Directory "/mnt/website/forum">

#  Options ExecCGI FollowSymLinks Includes IncludesNOEXEC +Indexes MultiViews

#  AllowOverride none

#  Order allow,deny

#  Allow from all

# </Directory>

NameVirtualHost website.org

<VirtualHost website.org>

 # primary vhost - Forum

 DocumentRoot /mnt/website/forum

DirectoryIndex index.php

 <Directory "/mnt/website/forum">

 Options All MultiViews FollowSymLinks ExecCGI IncludesNOEXEC +Indexes

 AllowOverride none

 Order allow,deny

 Allow from all

</Directory>

```

This is my apache2.conf

```
### /etc/apache2/conf/apache2.conf

### $Id: apache2.conf,v 1.3 2003/09/25 02:20:48 woodchip Exp $

###

### Main Configuration Section

### You really shouldn't change these settings unless you're a guru

###

ServerRoot /etc/apache2

ServerName website.org

#LockFile /etc/apache2/apache2.lock

PidFile /var/run/apache2.pid

ErrorLog logs/error_log

LogLevel warn

### Dynamic Shared Object (DSO) Support

### 

### You should always leave these three, as they are needed for normal use.

### mod_access (Order, Allow, etc..)

### mod_log_config (Transferlog, etc..)

### mod_mime (AddType, etc...)

###

LoadModule access_module                 modules/mod_access.so

LoadModule auth_module                   modules/mod_auth.so

LoadModule auth_anon_module              modules/mod_auth_anon.so

LoadModule auth_dbm_module               modules/mod_auth_dbm.so

LoadModule auth_digest_module            modules/mod_auth_digest.so

LoadModule include_module                modules/mod_include.so

LoadModule log_config_module             modules/mod_log_config.so

LoadModule env_module                    modules/mod_env.so

LoadModule mime_magic_module             modules/mod_mime_magic.so

LoadModule cern_meta_module              modules/mod_cern_meta.so

LoadModule expires_module                modules/mod_expires.so

LoadModule headers_module                modules/mod_headers.so

LoadModule usertrack_module              modules/mod_usertrack.so

LoadModule unique_id_module              modules/mod_unique_id.so

LoadModule setenvif_module               modules/mod_setenvif.so

LoadModule proxy_module                  modules/mod_proxy.so

LoadModule proxy_connect_module          modules/mod_proxy_connect.so

LoadModule proxy_ftp_module              modules/mod_proxy_ftp.so

LoadModule proxy_http_module            modules/mod_proxy_http.so

LoadModule mime_module                   modules/mod_mime.so

LoadModule status_module                 modules/mod_status.so

LoadModule autoindex_module              modules/mod_autoindex.so

LoadModule asis_module                   modules/mod_asis.so

LoadModule info_module                   modules/mod_info.so

LoadModule cgi_module                    modules/mod_cgi.so

LoadModule cgid_module                   modules/mod_cgid.so

LoadModule vhost_alias_module            modules/mod_vhost_alias.so

LoadModule negotiation_module            modules/mod_negotiation.so

LoadModule dir_module                    modules/mod_dir.so

LoadModule imap_module                   modules/mod_imap.so

LoadModule actions_module                modules/mod_actions.so

LoadModule speling_module                modules/mod_speling.so

LoadModule userdir_module                modules/mod_userdir.so

LoadModule alias_module                  modules/mod_alias.so

LoadModule rewrite_module                modules/mod_rewrite.so

###

### New Modules for 2.0 (some are experimental)

###

LoadModule file_cache_module             modules/mod_file_cache.so

LoadModule echo_module                   modules/mod_echo.so

LoadModule charset_lite_module           modules/mod_charset_lite.so

LoadModule cache_module                  modules/mod_cache.so

LoadModule disk_cache_module             modules/mod_disk_cache.so

LoadModule mem_cache_module              modules/mod_mem_cache.so

LoadModule ext_filter_module             modules/mod_ext_filter.so

LoadModule case_filter_module            modules/mod_case_filter.so

LoadModule case_filter_in_module         modules/mod_case_filter_in.so

LoadModule deflate_module                modules/mod_deflate.so

#LoadModule optional_hook_export_module   modules/mod_optional_hook_export.so

#LoadModule optional_hook_import_module   modules/mod_optional_hook_import.so

#LoadModule optional_fn_import_module     modules/mod_optional_fn_import.so

#LoadModule optional_fn_export_module     modules/mod_optional_fn_export.so

#LoadModule bucketeer_module              modules/mod_bucketeer.so

LoadModule logio_module                  modules/mod_logio.so

###

### Global Configuration

###

# Splitting up apache2.conf into two files makes it easier to support

# multiple configurations on the same serer.  In commonapache2.conf

# you keep directives that apply to all implementations and in this

# file you keep server-specific directives.  While we don't yet have

# multiple configurations out-of-the-box, this allows us to do that

# in the future easily.  (PERLPROXIED *ahem*)

#

# For Apache2 we load all conf files in conf/modules.d

Include conf/modules.d/*.conf

Include conf/commonapache2.conf

###

### IP Address/Port

###

#BindAddress *

Listen 80

###

### Log configuration Section

###

<IfModule mod_log_config.c>

#Single logfile with access, agent and referer information

#This is the default, if vlogs are not defined for the main server

CustomLog logs/access_log combined env=!VLOG

#If VLOG is defined in conf/vhosts/vhosts.conf, we use this entry

#CustomLog "|/usr/sbin/apache2splitlogfile" vhost env=VLOG

</IfModule>

DirectoryIndex 

 <Directory "/mnt/website/forum/songs">

  Options ExecCGI FollowSymLinks Includes IncludesNOEXEC +Indexes MultiViews

  AllowOverride none

  Order allow,deny

  allow from all

  Allow from dyn.iinet.net.au

  Allow from ext.fujitsu.com.au

  Allow from 216.

 </Directory>

#DirectoryIndex index.php

#<Directory "/mnt/website/forum">

  

#Options ExecCGI FollowSymLinks Includes IncludesNOEXEC +Indexes MultiViews

#AllowOverride none

#Order allow,deny

#Allow from all

#</Directory>

 <Directory "/mnt/website/forum/templates">

  Options ExecCGI FollowSymLinks Includes IncludesNOEXEC +Indexes MultiViews

  DirectoryIndex index.html

  Allow from all

 </Directory>

<Directory "/mnt/website/forum/db">

  Options ExecCGI FollowSymLinks Includes IncludesNOEXEC +Indexes MultiViews

  DirectoryIndex index.html

  Allow from all

 </Directory>

<Directory "/mnt/website/forum/cache">

  Options ExecCGI FollowSymLinks Includes IncludesNOEXEC +Indexes MultiViews

  DirectoryIndex index.html

  Allow from all

 </Directory>

<Directory "/mnt/website/forum/images">

  Options ExecCGI FollowSymLinks Includes IncludesNOEXEC +Indexes MultiViews

  DirectoryIndex index.html

  Allow from all

 </Directory>

<Directory "/mnt/website/forum/includes">

  Options ExecCGI FollowSymLinks Includes IncludesNOEXEC +Indexes MultiViews

  DirectoryIndex index.html

  Allow from all

 </Directory>

<Directory "/mnt/website/forum/language">

  Options ExecCGI FollowSymLinks Includes IncludesNOEXEC +Indexes MultiViews

  DirectoryIndex index.html

  Allow from all

 </Directory>

#</VirtualHost>

###

### Performance settings Section

###

#

# Timeout: The number of seconds before receives and sends time out.

#

Timeout 300

#

# KeepAlive: Whether or not to allow persistent connections (more than

# one request per connection). Set to "Off" to deactivate.

#

KeepAlive On

#

# MaxKeepAliveRequests: The maximum number of requests to allow

# during a persistent connection. Set to 0 to allow an unlimited amount.

# We recommend you leave this number high, for maximum performance.

#

MaxKeepAliveRequests 100

#

# KeepAliveTimeout: Number of seconds to wait for the next request from the

# same client on the same connection.

#

KeepAliveTimeout 15

# prefork MPM [THIS IS THE DEFAULT]

# StartServers: number of server processes to start

# MinSpareServers: minimum number of server processes which are kept spare

# MaxSpareServers: maximum number of server processes which are kept spare

# MaxClients: maximum number of server processes allowed to start

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule prefork.c>

StartServers         5

MinSpareServers      5

MaxSpareServers     10

MaxClients         150

MaxRequestsPerChild  0

</IfModule>

# worker MPM

# StartServers: initial number of server processes to start

# MaxClients: maximum number of simultaneous client connections

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# ThreadsPerChild: constant number of worker threads in each server process

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule worker.c>

StartServers         2

MaxClients         150

MinSpareThreads     25

MaxSpareThreads     75

ThreadsPerChild     25

MaxRequestsPerChild  0

</IfModule>

# perchild MPM

# NumServers: constant number of server processes

# StartThreads: initial number of worker threads in each server process

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# MaxThreadsPerChild: maximum number of worker threads in each server process

# MaxRequestsPerChild: maximum number of connections per server process

<IfModule perchild.c>

NumServers           5

StartThreads         5

MinSpareThreads      5

MaxSpareThreads     10

MaxThreadsPerChild  20

MaxRequestsPerChild  0

</IfModule>

```

this is the contents of my vhosts.d directory

```
### Section 3: Virtual Hosts

#

# VirtualHost: If you want to maintain multiple domains/hostnames on your

# machine you can setup VirtualHost containers for them. Most configurations

# use only name-based virtual hosts so the server doesn't need to worry about

# IP addresses. This is indicated by the asterisks in the directives below.

#

# Please see the documentation at 

# <URL:http://httpd.apache.org/docs-2.0/vhosts/>

# for further details before you try to setup virtual hosts.

#

# You may use the command line option '-S' to verify your virtual host

# configuration.

#

# Use name-based virtual hosting.

#

NameVirtualHost website.org

#

# VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for requests without a known

# server name.

#

#<VirtualHost *:80>

#    ServerAdmin webmaster@dummy-host.example.com

#    DocumentRoot /www/docs/dummy-host.example.com

#    ServerName dummy-host.example.com

#    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log

#    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common

#</VirtualHost>

#

# The First Virtual Host is also your DEFAULT Virtual Host.

# This means any requests that do not match any other vhosts will 

# goto this virtual host.

#

<IfDefine DEFAULT_VHOST>

<VirtualHost website.org>

    #

    # DocumentRoot: The directory out of which you will serve your

    # documents. By default, all requests are taken from this directory, but

    # symbolic links and aliases may be used to point to other locations.

    #

    DocumentRoot /mnt/website/forum

    #

    # This should be changed to whatever you set DocumentRoot to.

    #

    <Directory "/mnt/website/forum">

        #

        # Possible values for the Options directive are "None", "All",

        # or any combination of:

        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

        #

        # Note that "MultiViews" must be named *explicitly* --- "Options All"

        # doesn't give it to you.

        #

        # The Options directive is both complicated and important.  Please see

        # http://httpd.apache.org/docs-2.0/mod/core.html#options

        # for more information.

        #

        Options All Multiviews ExecCGI IncludesNOEXEC +Indexes FollowSymLinks

        #

        # AllowOverride controls what directives may be placed in .htaccess files.

        # It can be "All", "None", or any combination of the keywords:

        #   Options FileInfo AuthConfig Limit

        #

        AllowOverride None

        #

        # Controls who can get stuff from this server.

        #

        Order allow,deny

        Allow from all

    </Directory>

    <IfModule peruser.c>

        # this must match a Processor

        ServerEnvironment apache apache

        # these are optional - defaults to the values specified in httpd.conf

        MinSpareProcessors 4

        MaxProcessors 20

    </IfModule>

    <IfModule itk.c>

        # The userid and groupid this VirtualHost will run as

        AssignUserID apache apache

        # Optional: A separate MaxClients for the VirtualHost,

        # to limit the maximum number of processes

        MaxClientsVHost 50

        # Note that if you do not assign a user ID for your

        # VirtualHosts, none will be assigned by default,

        # ie. you'll run as root. Don't forget this!

    </IfModule>

</VirtualHost>

</IfDefine>

```

Lastly my init.d/apache2 file.

```
#!/sbin/runscript

# Copyright 1999-2004 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/net-www/apache/files/2.0.49/apache2.initd,v 1.8 2004/07/15 00:24:42 agriffis Exp $

opts="${opts} reload"

[ "x${SERVERROOT}" != "x" ] && APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}"

[ "x${CONFIGFILE}" != "x" ] && APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}"

[ "x${STARTUPERRORLOG}" != "x" ] && APACHE2_OPTS="${APACHE2_OPTS} -E ${STARTUPERRORLOG}"

# set a default for PIDFILE/RESTARTSTYLE for those that FAILED to follow

# instructiosn and update the conf.d/apache2 file.

# (bug #38787)

[ -z "${PIDFILE}" ] && PIDFILE=/var/run/apache2.pid

[ -z "${RESTARTSTYLE}" ] && RESTARTSTYLE="graceful"

checkconfig() {

   local myconf="/etc/apache2/conf/apache2.conf"

   if [ "x${CONFIGFILE}" != "x" ]; then

      if [ ${CONFIGFILE:0:1} = "/" ]; then

         myconf="${CONFIGFILE}"

      else

         myconf="${SERVERROOT:-/usr/lib/apache2}/${CONFIGFILE}"

      fi

   fi

   if [ ! -r "${myconf}" ]; then

      eerror "Unable to read configuration file: ${myconf}"

      return 1

   fi

    if [ -z "${PIDFILE}" ]; then

        eerror "\$PIDFILE is not set!"

        eerror "Did you etc-update /etc/conf.d/apache2?"

        return 1

    fi

    if [ -z "${RESTARTSTYLE}" ]; then

        eerror "\$RESTARTSTYLE is not set!"

        eerror "Did you etc-update /etc/conf.d/apache2?"

        return 1

    fi

   /usr/sbin/apache2 -t ${APACHE2_OPTS} 1>/dev/null 2>&1

   ret=$?

   if [ $ret -ne 0 ]; then

      eerror "Apache2 has detected a syntax error in your configuration files:"

      /usr/sbin/apache2 -t ${APACHE2_OPTS}

   fi

   return $ret

}

depend() {

   need net

   use mysql dns logger netmount postgres

   after sshd

}

start() {

   checkconfig || return 1

   ebegin "Starting apache2"

   [ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache

   [ -f /usr/lib/apache2/build/envvars ] && . /usr/lib/apache2/build/envvars

   env -i PATH=$PATH /sbin/start-stop-daemon --quiet \

      --start --startas /usr/sbin/apache2 \

      --pidfile ${PIDFILE} -- -k start ${APACHE2_OPTS}

   eend $?

}

stop() {

   ebegin "Stopping apache2"

   /usr/sbin/apache2ctl stop >/dev/null

   start-stop-daemon -o --quiet --stop --pidfile ${PIDFILE}

   eend $?

}

reload() {

   # restarting apache2 is much easier than apache1. The server handles most of the work for us. 

   # see http://httpd.apache.org/docs-2.0/stopping.html for more details

   ebegin "Restarting apache2"

   /usr/sbin/apache2 ${APACHE2_OPTS} -k ${RESTARTSTYLE}

   eend $?

}

```

Sorry guys for the long post.  I am just really at a loss on what to do, i am so confused.  Any help would be appreciated.

----------

## c4

Hey!

Now I don't use apache any more so I'm rusty on the configs, but when using vhosts I found the kind of setup below to be the easiest to use.

Instead of stating your virtual host as a namebased virtualhosting (NameVirtualHost website.org), why not try the other method and use *:80, and than state your host with the ServerName variable?

See below 

For instance in your case you could use 

NameVirtualHost *:80

<VirtualHost *:80>

ServerName website.org

ServerAlias website.org *.website.org

    DocumentRoot "/mnt/website/forum"

    <Directory "/mnt/website/forum">

        AllowOverride None

        Order allow,deny

        Allow from all

    </Directory>

</VirtualHost> 

etc etc with your directory settings.

for each new vhost, just copy and paste a simular block with 

<VirtualHost *:80>

ServerName website2.org

ServerAlias website2.org *.website2.org

    DocumentRoot "/mnt/website2/forum"

    <Directory "/mnt/website2/forum">

        ...

    </Directory>

</VirtualHost> 

and that should do it.

----------

## paul7v7

Thanks C4, I have given that a go but it doesn't seem to be reading the VHOSTS file.  From what i have read here, httpd.conf is what used to be apache2.conf?  Is that right and the config file in vhosts.d is what used to be vhosts.conf?

----------

## c4

Yesm the new configfile fopr apache is httpd.conf, and replaces the old ones apache.conf and commonapache.conf.

As for the vhost, this was how I used to run / read the vhost.conf file:

```
#

# Gentoo VHosts

# 

# For Gentoo we include External Virtual Hosts Files.

#

Include conf/vhosts.d/vhosts.conf

```

and I kept all other vhosts in there. I hade my primary vhost in my httpd.conf file. Perhaps your apache is getting multiple vhost settings if your are reading all files included in the vhost directory?

----------

## paul7v7

Ok thanks again.  I decided to restart the apache install, so i backed everything up into another directory and rebuilt apache. 

In my httpd.conf i have the following:

```
ServerRoot "/usr/lib/apache2"

#

# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.

#

#LockFile "/var/run/apache2.lock"

#

# ScoreBoardFile: File used to store internal server process information.

# If unspecified (the default), the scoreboard will be stored in an

# anonymous shared memory segment, and will be unavailable to third-party

# applications.

# If specified, ensure that no two invocations of Apache share the same

# scoreboard file. The scoreboard file MUST BE STORED ON A LOCAL DISK.

#

<IfModule !perchild.c>

    #ScoreBoardFile /var/run/apache2_runtime_status

</IfModule>

#

# PidFile: The file in which the server should record its process

# identification number when it starts.

#

PidFile "/var/run/apache2.pid"

#

# Timeout: The number of seconds before receives and sends time out.

#

Timeout 300

#

# KeepAlive: Whether or not to allow persistent connections (more than

# one request per connection). Set to "Off" to deactivate.

#

KeepAlive On

#

# MaxKeepAliveRequests: The maximum number of requests to allow

# during a persistent connection. Set to 0 to allow an unlimited amount.

# We recommend you leave this number high, for maximum performance.

#

MaxKeepAliveRequests 100

#

# KeepAliveTimeout: Number of seconds to wait for the next request from the

# same client on the same connection.

#

KeepAliveTimeout 15

##

## Server-Pool Size Regulation (MPM specific)

## 

# prefork MPM [DEFAULT IF USE=-threads]

# StartServers: number of server processes to start

# MinSpareServers: minimum number of server processes which are kept spare

# MaxSpareServers: maximum number of server processes which are kept spare

# MaxClients: maximum number of server processes allowed to start

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule prefork.c>

    StartServers         5

    MinSpareServers      5

    MaxSpareServers     10

    MaxClients         150

    MaxRequestsPerChild  0

</IfModule>

# worker MPM [DEFAULT IF USE=threads]

# StartServers: initial number of server processes to start

# MaxClients: maximum number of simultaneous client connections

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# ThreadsPerChild: constant number of worker threads in each server process

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule worker.c>

    StartServers         2

    MaxClients         150

    MinSpareThreads     25

    MaxSpareThreads     75 

    ThreadsPerChild     25

    MaxRequestsPerChild  0

</IfModule>

# perchild MPM [THIS MPM IS NOT SUPPORTED]

# NumServers: constant number of server processes

# StartThreads: initial number of worker threads in each server process

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# MaxThreadsPerChild: maximum number of worker threads in each server process

# MaxRequestsPerChild: maximum number of connections per server process

<IfModule perchild.c>

    NumServers           5

    StartThreads         5

    MinSpareThreads      5

    MaxSpareThreads     10

    MaxThreadsPerChild  20

    MaxRequestsPerChild  0

</IfModule>

# peruser MPM [THIS MPM IS NOT SUPPORTED]

# MinSpareServers - Minimum number of idle children, to handle request spikes 

# MaxClients - Maximum number of children alive at the same time 

# MaxProcessors - Maximum number of processors per vhost

# Multiplexer - Specify an Multiplexer Child configuration.

# Processor - Specify a User and Group for a specific child process.

# ServerEnvironment - Specify the server environment for this virtual host.

<IfModule peruser.c>

    ServerLimit          256

    MaxClients           256

    MinSpareProcessors     2

    MaxProcessors         10

    MaxRequestsPerChild 1000

    

    # kill off idle processors after this many seconds

    # set to 0 to disable

    ExpireTimeout       1800

    

    Multiplexer nobody nobody

    

    Processor apache apache

    

    # chroot dir is optional:

    # Processor user group /path/to/chroot

</IfModule>

# itk MPM [THIS MPM IS NOT SUPPORTED]

# StartServers: number of server processes to start

# MinSpareServers: minimum number of server processes which are kept spare

# MaxSpareServers: maximum number of server processes which are kept spare

# MaxClients: maximum number of server processes allowed to start

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule itk.c>

    StartServers           5

    MinSpareServers        2

    MaxSpareServers       10

    MaxClients           150

    MaxRequestsPerChild 1000

</IfModule>

#

# Listen: Allows you to bind Apache to specific IP addresses and/or

# ports, instead of the default. See also the <VirtualHost>

# directive.

#

# Change this to Listen on specific IP addresses as shown below to 

# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)

#

#Listen 12.34.56.78:80

Listen 80

#

# Dynamic Shared Object (DSO) Support

#

# To be able to use the functionality of a module which was built as a DSO you

# have to place corresponding `LoadModule' lines at this location so the

# directives contained in it are actually available _before_ they are used.

# Statically compiled modules (those listed by `httpd -l') do not need

# to be loaded here.

#

# The following modules are considered as the default configuration.

# If you wish to disable one of them, you may have to alter other 

# configuration directives.

#

# You should always leave these three, as they are needed for normal use.

# mod_access (Order, Allow, etc..)

# mod_log_config (Transferlog, etc..)

# mod_mime (AddType, etc...)

#

# Example:

# LoadModule foo_module modules/mod_foo.so

# Authentication Modules

#

# These modules provide authentication and authorization for

# clients. They should not normally be disabled.

#

LoadModule access_module                 modules/mod_access.so

LoadModule auth_module                   modules/mod_auth.so

LoadModule auth_anon_module              modules/mod_auth_anon.so

LoadModule auth_dbm_module               modules/mod_auth_dbm.so

LoadModule auth_digest_module            modules/mod_auth_digest.so

#

# Metadata Modules

# 

# These modules provide extra data to clients about

# a file, such as the mime-type or charset.

#

LoadModule charset_lite_module           modules/mod_charset_lite.so

LoadModule env_module                    modules/mod_env.so

LoadModule expires_module                modules/mod_expires.so

LoadModule headers_module                modules/mod_headers.so

LoadModule mime_module                   modules/mod_mime.so

LoadModule negotiation_module            modules/mod_negotiation.so

LoadModule setenvif_module               modules/mod_setenvif.so

#

# Logging Modules

# 

# These modules provide logging services for Apache

#

LoadModule log_config_module             modules/mod_log_config.so

LoadModule logio_module                  modules/mod_logio.so

#

# CGI Modules

#

# These modules provide the ability to execute CGI Scripts.

#

LoadModule cgi_module                    modules/mod_cgi.so

LoadModule cgid_module                   modules/mod_cgid.so

#

# This `suexec` module provides the ability to exeucte CGI scripts under

# a different user than apache is run.

#

LoadModule suexec_module                 modules/mod_suexec.so

#

# Mappers

#

# These Modules provide URL mappings or translations.

LoadModule alias_module                  modules/mod_alias.so

LoadModule rewrite_module                modules/mod_rewrite.so

<IfDefine USERDIR>

    LoadModule userdir_module            modules/mod_userdir.so

</IfDefine>

#

# Handlers

#

# These modules create content for a client.

#

<IfDefine INFO>

    LoadModule info_module               modules/mod_info.so

    LoadModule status_module             modules/mod_status.so

</IfDefine>

LoadModule actions_module                modules/mod_actions.so

LoadModule autoindex_module              modules/mod_autoindex.so

LoadModule dir_module                    modules/mod_dir.so

#

# Filters

#

# These modules provide filters for Apache.

# They preform common tasks like gzip encoding or SSI

#

#

LoadModule ext_filter_module             modules/mod_ext_filter.so

LoadModule deflate_module                modules/mod_deflate.so

LoadModule include_module                modules/mod_include.so

#

# Cache Modules

#

# The following modules are used for storing a cache of

# generated or proxied content.

#

#LoadModule cache_module                  modules/mod_cache.so

#LoadModule disk_cache_module             modules/mod_disk_cache.so

#LoadModule mem_cache_module              modules/mod_mem_cache.so

#LoadModule file_cache_module             modules/mod_file_cache.so

#

# Proxy Modules

# 

# The following modules are only needed if you are running

# Apache as a Forward or Reverse Proxy.

# 

# WARNING: Enabling these modules can be dangerous! 

#   READ THE DOCUMENTATION FIRST:

#   http://httpd.apache.org/docs/2.0/mod/mod_proxy.html

<IfDefine PROXY>

    LoadModule proxy_module                  modules/mod_proxy.so

    LoadModule proxy_connect_module          modules/mod_proxy_connect.so

    LoadModule proxy_ftp_module              modules/mod_proxy_ftp.so

    LoadModule proxy_http_module             modules/mod_proxy_http.so

</IfDefine>

#

# Uncommon Modules

#

# The following Modules are not commonly loaded for Apache

#

#LoadModule case_filter_module            modules/mod_case_filter.so

#LoadModule case_filter_in_module         modules/mod_case_filter_in.so

#LoadModule echo_module                   modules/mod_echo.so

#LoadModule mime_magic_module             modules/mod_mime_magic.so

#LoadModule speling_module                modules/mod_speling.so

#LoadModule unique_id_module              modules/mod_unique_id.so

#LoadModule vhost_alias_module            modules/mod_vhost_alias.so

#

# Obsolete Modules

# 

# The Following modules are not commonly needed and use 

# obsolete technologies.

#

#LoadModule cern_meta_module              modules/mod_cern_meta.so

#LoadModule imap_module                   modules/mod_imap.so

#LoadModule usertrack_module              modules/mod_usertrack.so

#LoadModule asis_module                   modules/mod_asis.so

#

# Extra Modules

#

# We Include extra .conf files from /etc/apache2/modules.d

# This is used to load things like PHP and mod_ssl.

#

Include /etc/apache2/modules.d/*.conf

### Section 2: 'Main' server configuration

#

# The directives in this section set up the values used by the 'main'

# server, which responds to any requests that aren't handled by a

# <VirtualHost> definition.  These values also provide defaults for

# any <VirtualHost> containers you may define later in the file.

#

# All of these directives may appear inside <VirtualHost> containers,

# in which case these default settings will be overridden for the

# virtual host being defined.

#

#

# If you wish httpd to run as a different user or group, you must run

# httpd as root initially and it will switch.  

#

# User/Group: The name (or #number) of the user/group to run httpd as.

#  . On SCO (ODT 3) use "User nouser" and "Group nogroup".

#  . On HPUX you may not be able to use shared memory as nobody, and the

#    suggested workaround is to create a user www and use that user.

#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)

#  when the value of (unsigned)Group is above 60000; 

#  don't use Group #-1 on these systems!

#

User apache

Group apache

#

# ServerAdmin: Your address, where problems with the server should be

# e-mailed.  This address appears on some server-generated pages, such

# as error documents.  e.g. admin@your-domain.com

#

ServerAdmin root@localhost

#

# ServerName gives the name and port that the server uses to identify itself.

# This can often be determined automatically, but we recommend you specify

# it explicitly to prevent problems during startup.

#

# If this is not set to valid DNS name for your host, server-generated

# redirections will not work.  See also the UseCanonicalName directive.

#

# If your host doesn't have a registered DNS name, enter its IP address here.

# You will have to access it by its address anyway, and this will make 

# redirections work in a sensible way.

#

ServerName website.org

#

# UseCanonicalName: Determines how Apache constructs self-referencing 

# URLs and the SERVER_NAME and SERVER_PORT variables.

# When set "Off", Apache will use the Hostname and Port supplied

# by the client.  When set "On", Apache will use the value of the

# ServerName directive.

#

UseCanonicalName Off

#

# Each directory to which Apache has access can be configured with respect

# to which services and features are allowed and/or disabled in that

# directory (and its subdirectories). 

#

# First, we configure the "default" to be a very restrictive set of 

# features.  

#

<Directory /mnt/website/forum>

    Options All MultiViews FollowSymLinks Indexes 

    AllowOverride None

    Order Allow,Deny

    Allow from all

</Directory>

#

# Note that from this point forward you must specifically allow

# particular features to be enabled - so if something's not working as

# you might expect, make sure that you have specifically enabled it

# below.

#

#

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

# directory if a ~user request is received.

# enable by adding -D USERDIR to /etc/conf.d/apache2

#

<IfModule mod_userdir.c>

    UserDir public_html

#

# Control access to UserDir directories.  The following is an example

# for a site where these directories are restricted to read-only.

#

    <Directory /home/*/public_html>

        AllowOverride FileInfo AuthConfig Limit Indexes

        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>

# Enable this additional section if you would like to make use of a

# suexec-enabled cgi-bin directory on a per-user basis.

#

#<Directory /home/*/public_html/cgi-bin>

#    Options ExecCGI

#    SetHandler cgi-script

#</Directory>

</IfModule>

#

# DirectoryIndex: sets the file that Apache will serve if a directory

# is requested.

#

# The index.html.var file (a type-map) is used to deliver content-

# negotiated documents.  The MultiViews Option can be used for the 

# same purpose, but it is much slower.

#

DirectoryIndex index.html index.html.var index.htm

#

# AccessFileName: The name of the file to look for in each directory

# for additional configuration directives.  See also the AllowOverride 

# directive.

#

AccessFileName .htaccess

#

# The following lines prevent .htaccess and .htpasswd files from being 

# viewed by Web clients. 

#

<FilesMatch "^\.ht">

    Order allow,deny

    Deny from all

</FilesMatch>

#

# TypesConfig describes where the mime.types file (or equivalent) is

# to be found.

#

TypesConfig /etc/mime.types

#

# DefaultType is the default MIME type the server will use for a document

# if it cannot otherwise determine one, such as from filename extensions.

# If your server contains mostly text or HTML documents, "text/plain" is

# a good value.  If most of your content is binary, such as applications

# or images, you may want to use "application/octet-stream" instead to

# keep browsers from trying to display binary files as though they are

# text.

#

DefaultType text/plain

#

# The mod_mime_magic module allows the server to use various hints from the

# contents of the file itself to determine its type.  The MIMEMagicFile

# directive tells the module where the hint definitions are located.

#

<IfModule mod_mime_magic.c>

    MIMEMagicFile /etc/apache2/magic

</IfModule>

#

# HostnameLookups: Log the names of clients or just their IP addresses

# e.g., www.apache.org (on) or 204.62.129.132 (off).

# The default is off because it'd be overall better for the net if people

# had to knowingly turn this feature on, since enabling it means that

# each client request will result in AT LEAST one lookup request to the

# nameserver.

#

HostnameLookups Off

#

# EnableMMAP: Control whether memory-mapping is used to deliver

# files (assuming that the underlying OS supports it).

# The default is on; turn this off if you serve from NFS-mounted 

# filesystems.  On some systems, turning it off (regardless of

# filesystem) can improve performance; for details, please see

# http://httpd.apache.org/docs/2.0/mod/core.html#enablemmap

#

#EnableMMAP off

#

# EnableSendfile: Control whether the sendfile kernel support is 

# used  to deliver files (assuming that the OS supports it).

# The default is on; turn this off if you serve from NFS-mounted 

# filesystems.  Please see

# http://httpd.apache.org/docs/2.0/mod/core.html#enablesendfile

#

#EnableSendfile off

#

# ErrorLog: The location of the error log file.

# If you do not specify an ErrorLog directive within a <VirtualHost>

# container, error messages relating to that virtual host will be

# logged here.  If you *do* define an error logfile for a <VirtualHost>

# container, that host's errors will be logged there and not here.

#

ErrorLog logs/error_log

#

# LogLevel: Control the number of messages logged to the error_log.

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

#

LogLevel warn

#

# The following directives define some format nicknames for use with

# a CustomLog directive (see below).

#

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

LogFormat "%v %h %l %u %t \"%r\" %>s %b %T" script

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" VLOG=%{VLOG}e" vhost

# You need to enable mod_logio.c to use %I and %O

#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

#

# The location and format of the access logfile (Common Logfile Format).

# If you do not define any access logfiles within a <VirtualHost>

# container, they will be logged here.  Contrariwise, if you *do*

# define per-<VirtualHost> access logfiles, transactions will be

# logged therein and *not* in this file.

#

CustomLog logs/access_log common

#

# If you would like to have agent and referer logfiles, uncomment the

# following directives.

#

#CustomLog logs/referer_log referer

#CustomLog logs/agent_log agent

#

# If you prefer a single logfile with access, agent, and referer information

# (Combined Logfile Format) you can use the following directive.

#

#CustomLog logs/access_log combined

#

# ServerTokens

# This directive configures what you return as the Server HTTP response

# Header. The default is 'Full' which sends information about the OS-Type

# and compiled in modules.

# Set to one of:  Full | OS | Minor | Minimal | Major | Prod

# where Full conveys the most information, and Prod the least.

#

ServerTokens Prod

#

# Optionally add a line containing the server version and virtual host

# name to server-generated pages (internal error documents, FTP directory 

# listings, mod_status and mod_info output etc., but not CGI generated 

# documents or custom error documents).

# Set to "EMail" to also include a mailto: link to the ServerAdmin.

# Set to one of:  On | Off | EMail

#

ServerSignature On

#

# Aliases: Add here as many aliases as you need (with no limit). The format is 

# Alias fakename realname

#

# Note that if you include a trailing / on fakename then the server will

# require it to be present in the URL.  So "/icons" isn't aliased in this

# example, only "/icons/".  If the fakename is slash-terminated, then the 

# realname must also be slash terminated, and if the fakename omits the 

# trailing slash, the realname must also omit it.

#

# We include the /icons/ alias for FancyIndexed directory listings.  If you

# do not use FancyIndexing, you may comment this out.

#

Alias /icons/ "/var/www/localhost/icons/"

<Directory "/var/www/localhost/icons/">

    Options Indexes MultiViews

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

#

# ScriptAlias: This controls which directories contain server scripts.

# ScriptAliases are essentially the same as Aliases, except that

# documents in the realname directory are treated as applications and

# run by the server when requested rather than as documents sent to the client.

# The same rules about trailing "/" apply to ScriptAlias directives as to

# Alias.

#

ScriptAlias /cgi-bin/ /var/www/localhost/cgi-bin/

<IfModule mod_cgid.c>

    #

    # Additional to mod_cgid.c settings, mod_cgid has Scriptsock <path>

    # for setting UNIX socket for communicating with cgid.

    #

    #Scriptsock            /var/run/cgisock

</IfModule>

#

# "/var/www/localhost/cgi-bin/" should be changed to whatever your ScriptAliased

# CGI directory exists, if you have that configured.

#

<Directory "/var/www/localhost/cgi-bin/">

    AllowOverride None

    Options None

    Order allow,deny

    Allow from all

</Directory>

#

# Redirect allows you to tell clients about documents which used to exist in

# your server's namespace, but do not anymore. This allows you to tell the

# clients where to look for the relocated document.

# Example:

# Redirect permanent /foo http://www.example.com/bar

#

# Directives controlling the display of server-generated directory listings.

#

<IfModule mod_autoindex.c>

    #

    # IndexOptions: Controls the appearance of server-generated directory

    # listings.

    #

    IndexOptions FancyIndexing VersionSort

    #

    # AddIcon* directives tell the server which icon to show for different

    # files or filename extensions.  These are only displayed for

    # FancyIndexed directories.

    #

    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

    AddIconByType (TXT,/icons/text.gif) text/*

    AddIconByType (IMG,/icons/image2.gif) image/*

    AddIconByType (SND,/icons/sound2.gif) audio/*

    AddIconByType (VID,/icons/movie.gif) video/*

    AddIcon /icons/binary.gif .bin .exe

    AddIcon /icons/binhex.gif .hqx

    AddIcon /icons/tar.gif .tar

    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv

    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip

    AddIcon /icons/a.gif .ps .ai .eps

    AddIcon /icons/layout.gif .html .shtml .htm .pdf

    AddIcon /icons/text.gif .txt

    AddIcon /icons/c.gif .c

    AddIcon /icons/p.gif .pl .py

    AddIcon /icons/f.gif .for

    AddIcon /icons/dvi.gif .dvi

    AddIcon /icons/uuencoded.gif .uu

    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl

    AddIcon /icons/tex.gif .tex

    AddIcon /icons/bomb.gif core

    AddIcon /icons/back.gif ..

    AddIcon /icons/hand.right.gif README

    AddIcon /icons/folder.gif ^^DIRECTORY^^

    AddIcon /icons/blank.gif ^^BLANKICON^^

    #

    # DefaultIcon is which icon to show for files which do not have an icon

    # explicitly set.

    #

    DefaultIcon /icons/unknown.gif

    #

    # AddDescription allows you to place a short description after a file in

    # server-generated indexes.  These are only displayed for FancyIndexed

    # directories.

    # Format: AddDescription "description" filename

    #

    #AddDescription "GZIP compressed document" .gz

    #AddDescription "tar archive" .tar

    #AddDescription "GZIP compressed tar archive" .tgz

    #

    # ReadmeName is the name of the README file the server will look for by

    # default, and append to directory listings.

    #

    # HeaderName is the name of a file which should be prepended to

    # directory indexes. 

    ReadmeName README.html

    HeaderName HEADER.html

    #

    # IndexIgnore is a set of filenames which directory indexing should ignore

    # and not include in the listing.  Shell-style wildcarding is permitted.

    #

    IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t .svn

</IfModule>

#

# DefaultLanguage and AddLanguage allows you to specify the language of 

# a document. You can then use content negotiation to give a browser a 

# file in a language the user can understand.

#

# Specify a default language. This means that all data

# going out without a specific language tag (see below) will 

# be marked with this one. You probably do NOT want to set

# this unless you are sure it is correct for all cases.

#

# * It is generally better to not mark a page as 

# * being a certain language than marking it with the wrong

# * language!

#

# DefaultLanguage nl

#

# Note 1: The suffix does not have to be the same as the language

# keyword --- those with documents in Polish (whose net-standard

# language code is pl) may wish to use "AddLanguage pl .po" to

# avoid the ambiguity with the common suffix for perl scripts.

#

# Note 2: The example entries below illustrate that in some cases 

# the two character 'Language' abbreviation is not identical to 

# the two character 'Country' code for its country,

# E.g. 'Danmark/dk' versus 'Danish/da'.

#

# Note 3: In the case of 'ltz' we violate the RFC by using a three char

# specifier. There is 'work in progress' to fix this and get

# the reference data for rfc1766 cleaned up.

#

# Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)

# English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)

# Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)

# Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)

# Norwegian (no) - Polish (pl) - Portugese (pt)

# Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)

# Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)

#

AddLanguage ca .ca

AddLanguage cs .cz .cs

AddLanguage da .dk

AddLanguage de .de

AddLanguage el .el

AddLanguage en .en

AddLanguage eo .eo

AddLanguage es .es

AddLanguage et .et

AddLanguage fr .fr

AddLanguage he .he

AddLanguage hr .hr

AddLanguage it .it

AddLanguage ja .ja

AddLanguage ko .ko

AddLanguage ltz .ltz

AddLanguage nl .nl

AddLanguage nn .nn

AddLanguage no .no

AddLanguage pl .po

AddLanguage pt .pt

AddLanguage pt-BR .pt-br

AddLanguage ru .ru

AddLanguage sv .sv

AddLanguage zh-CN .zh-cn

AddLanguage zh-TW .zh-tw

#

# LanguagePriority allows you to give precedence to some languages

# in case of a tie during content negotiation.

#

# Just list the languages in decreasing order of preference. We have

# more or less alphabetized them here. You probably want to change this.

#

LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

#

# ForceLanguagePriority allows you to serve a result page rather than

# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)

# [in case no accepted languages matched the available variants]

#

ForceLanguagePriority Prefer Fallback

#

# Commonly used filename extensions to character sets. You probably

# want to avoid clashes with the language extensions, unless you

# are good at carefully testing your setup after each change.

# See http://www.iana.org/assignments/character-sets for the

# official list of charset names and their respective RFCs.

#

AddCharset ISO-8859-1  .iso8859-1  .latin1

AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen

AddCharset ISO-8859-3  .iso8859-3  .latin3

AddCharset ISO-8859-4  .iso8859-4  .latin4

AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru

AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb

AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk

AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb

AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk

AddCharset ISO-2022-JP .iso2022-jp .jis

AddCharset ISO-2022-KR .iso2022-kr .kis

AddCharset ISO-2022-CN .iso2022-cn .cis

AddCharset Big5        .Big5       .big5

# For russian, more than one charset is used (depends on client, mostly):

AddCharset WINDOWS-1251 .cp-1251   .win-1251

AddCharset CP866       .cp866

AddCharset KOI8-r      .koi8-r .koi8-ru

AddCharset KOI8-ru     .koi8-uk .ua

AddCharset ISO-10646-UCS-2 .ucs2

AddCharset ISO-10646-UCS-4 .ucs4

AddCharset UTF-8       .utf8

# The set below does not map to a specific (iso) standard

# but works on a fairly wide range of browsers. Note that

# capitalization actually matters (it should not, but it

# does for some browsers).

#

# See http://www.iana.org/assignments/character-sets

# for a list of sorts. But browsers support few.

#

AddCharset GB2312      .gb2312 .gb 

AddCharset utf-7       .utf7

AddCharset utf-8       .utf8

AddCharset big5        .big5 .b5

AddCharset EUC-TW      .euc-tw

AddCharset EUC-JP      .euc-jp

AddCharset EUC-KR      .euc-kr

AddCharset shift_jis   .sjis

#

# AddType allows you to add to or override the MIME configuration

# file mime.types for specific file types.

#

#AddType application/x-tar .tgz

#

# AddEncoding allows you to have certain browsers uncompress

# information on the fly. Note: Not all browsers support this.

# Despite the name similarity, the following Add* directives have nothing

# to do with the FancyIndexing customization directives above.

#

#AddEncoding x-compress .Z

#AddEncoding x-gzip .gz .tgz

#

# If the AddEncoding directives above are commented-out, then you

# probably should define those extensions to indicate media types:

#

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

#

# AddHandler allows you to map certain file extensions to "handlers":

# actions unrelated to filetype. These can be either built into the server

# or added with the Action directive (see below)

#

# To use CGI scripts outside of ScriptAliased directories:

# (You will also need to add "ExecCGI" to the "Options" directive.)

#

#AddHandler cgi-script .cgi

#

# For files that include their own HTTP headers:

#

#AddHandler send-as-is asis

#

# For server-parsed imagemap files:

#

#AddHandler imap-file map

#

# For type maps (negotiated resources):

# (This is enabled by default to allow the Apache "It Worked" page

#  to be distributed in multiple languages.)

#

AddHandler type-map var

#

# Filters allow you to process content before it is sent to the client.

#

# To parse .shtml files for server-side includes (SSI):

# (You will also need to add "Includes" to the "Options" directive.)

#

#AddType text/html .shtml

#AddOutputFilter INCLUDES .shtml

#

# Action lets you define media types that will execute a script whenever

# a matching file is called. This eliminates the need for repeated URL

# pathnames for oft-used CGI file processors.

# Format: Action media/type /cgi-script/location

# Format: Action handler-name /cgi-script/location

#

#

# Customizable error responses come in three flavors:

# 1) plain text 2) local redirects 3) external redirects

#

# Some examples:

#ErrorDocument 500 "The server made a boo boo."

#ErrorDocument 404 /missing.html

#ErrorDocument 404 "/cgi-bin/missing_handler.pl"

#ErrorDocument 402 http://www.example.com/subscription_info.html

#

#

# Putting this all together, we can internationalize error responses.

#

# We use Alias to redirect any /error/HTTP_<error>.html.var response to

# our collection of by-error message multi-language collections.  We use 

# includes to substitute the appropriate text.

#

# You can modify the messages' appearance without changing any of the

# default HTTP_<error>.html.var files by adding the line:

#

#   Alias /error/include/ "/your/include/path/"

#

# which allows you to create your own set of files by starting with the

# /var/www/localhost/error/include files and copying them to /your/includepath/ 

# even on a per-VirtualHost basis.  The default include files will display

# your Apache version number and your ServerAdmin email address regardless

# of the setting of ServerSignature.

#

# The internationalized error documents require mod_alias, mod_include

# and mod_negotiation.  To activate them, uncomment the following 30 lines.

#    Alias /error/ "/var/www/localhost/error/"

#

#    <Directory "/var/www/localhost/error">

#        AllowOverride None

#        Options IncludesNoExec

#        AddOutputFilter Includes html

#        AddHandler type-map var

#        Order allow,deny

#        Allow from all

#        LanguagePriority en cs de es fr it nl sv pt-br ro

#        ForceLanguagePriority Prefer Fallback

#    </Directory>

#

#    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var

#    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var

#    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var

#    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var

#    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var

#    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

#    ErrorDocument 410 /error/HTTP_GONE.html.var

#    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var

#    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var

#    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var

#    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var

#    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var

#    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var

#    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var

#    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var

#    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var

#    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

#

# The following directives modify normal HTTP response behavior to

# handle known problems with browser implementations.

#

BrowserMatch "Mozilla/2" nokeepalive

BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

BrowserMatch "RealPlayer 4\.0" force-response-1.0

BrowserMatch "Java/1\.0" force-response-1.0

BrowserMatch "JDK/1\.0" force-response-1.0

#

# The following directive disables redirects on non-GET requests for

# a directory that does not include the trailing slash.  This fixes a 

# problem with Microsoft WebFolders which does not appropriately handle 

# redirects for folders with DAV methods.

# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.

#

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully

BrowserMatch "MS FrontPage" redirect-carefully

BrowserMatch "^WebDrive" redirect-carefully

BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully

BrowserMatch "^gnome-vfs" redirect-carefully

BrowserMatch "^XML Spy" redirect-carefully

BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

#

# Allow server status reports generated by mod_status,

# with the URL of http://servername/server-status

# Change the ".example.com" to match your domain to enable.

#

<IfDefine INFO>

    ExtendedStatus On

    <Location /server-status>

        SetHandler server-status

        Order deny,allow

        Deny from all

        Allow from localhost

    </Location>

</IfDefine>

#

# Allow remote server configuration reports, with the URL of

#  http://localhost/server-info (This is useful for debugging)

#

<IfDefine INFO>

    <Location /server-info>

       SetHandler server-info

       Order deny,allow

       Deny from all

       Allow from localhost

    </Location>

</IfDefine>

#

# Gentoo VHosts

# 

# For Gentoo we include External Virtual Hosts Files.

# Please see vhosts.d/00_default_vhost.conf for the default virtual host.

#

Include /etc/apache2/vhosts.d/00_default_vhost.conf

```

Here is my 00_default_vhost.conf

```

### Section 3: Virtual Hosts

#

# VirtualHost: If you want to maintain multiple domains/hostnames on your

# machine you can setup VirtualHost containers for them. Most configurations

# use only name-based virtual hosts so the server doesn't need to worry about

# IP addresses. This is indicated by the asterisks in the directives below.

#

# Please see the documentation at 

# <URL:http://httpd.apache.org/docs-2.0/vhosts/>

# for further details before you try to setup virtual hosts.

#

# You may use the command line option '-S' to verify your virtual host

# configuration.

#

# Use name-based virtual hosting.

#

NameVirtualHost website.org

#

# VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for requests without a known

# server name.

#

#<VirtualHost *:80>

#    ServerAdmin webmaster@dummy-host.example.com

#    DocumentRoot /www/docs/dummy-host.example.com

#    ServerName dummy-host.example.com

#    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log

#    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common

#</VirtualHost>

#

# The First Virtual Host is also your DEFAULT Virtual Host.

# This means any requests that do not match any other vhosts will 

# goto this virtual host.

#

<IfDefine DEFAULT_VHOST>

<VirtualHost website.org>

    #

    # DocumentRoot: The directory out of which you will serve your

    # documents. By default, all requests are taken from this directory, but

    # symbolic links and aliases may be used to point to other locations.

    #

    DocumentRoot "/mnt/website/forum"

    DirectoryIndex index.php

    #

    # This should be changed to whatever you set DocumentRoot to.

    #

    <Directory "/mnt/website/forum">

        #

        # Possible values for the Options directive are "None", "All",

        # or any combination of:

        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

        #

        # Note that "MultiViews" must be named *explicitly* --- "Options All"

        # doesn't give it to you.

        #

        # The Options directive is both complicated and important.  Please see

        # http://httpd.apache.org/docs-2.0/mod/core.html#options

        # for more information.

        #

        Options All Indexes FollowSymLinks MultiViews ExecCGI IncludesNOEXEC

        #

        # AllowOverride controls what directives may be placed in .htaccess files.

        # It can be "All", "None", or any combination of the keywords:

        #   Options FileInfo AuthConfig Limit

        #

        AllowOverride None

        #

        # Controls who can get stuff from this server.

        #

        Order allow,deny

        Allow from all

    </Directory>

    <IfModule peruser.c>

        # this must match a Processor

        ServerEnvironment apache apache

        # these are optional - defaults to the values specified in httpd.conf

        MinSpareProcessors 4

        MaxProcessors 20

    </IfModule>

    <IfModule itk.c>

        # The userid and groupid this VirtualHost will run as

        AssignUserID apache apache

        # Optional: A separate MaxClients for the VirtualHost,

        # to limit the maximum number of processes

        MaxClientsVHost 50

        # Note that if you do not assign a user ID for your

        # VirtualHosts, none will be assigned by default,

        # ie. you'll run as root. Don't forget this!

    </IfModule>

</VirtualHost>

</IfDefine>

```

In my /etc/conf.d/apache this is now what is in there.

```
# /etc/conf.d/apache2: config file for /etc/init.d/apache2

# When you install a module it is easy to activate or deactivate the modules

# and other features of apache using the APACHE2_OPTS line. Every module should

# install a configuration in /etc/apache2/modules.d. In that file will be an

# <IfDefine NNN> where NNN is the option to enable that module.

# Here are the options available in the default configuration:

#   USERDIR   Enables /~username mapping to /home/username/public_html

#   INFO      Enables mod_info, a useful module for debugging

#   PROXY     Enables mod_proxy

#   DAV       Enables mod_dav

#   DAV_FS    Enables mod_dav_fs (you should enable this when you enable DAV

#             unless you know what you are doing)

#   SSL       Enables SSL

#   SSL_DEFAULT_VHOST  Enables default vhost for SSL (you should enable this

#                      when you enable SSL unless you know what you are doing)

#   LDAP      Enables mod_ldap

#   AUTH_LDAP Enables authentication through mod_ldap

#   DEFAULT_VHOST Enables the default virtual host in /var/www/localhost/htdocs

APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D USERDIR"

# Extended options for advanced uses of Apache ONLY

# You don't need to edit these unless you are doing crazy Apache stuff

# As not having them set correctly, or feeding in an incorrect configuration

# via them will result in Apache failing to start

# YOU HAVE BEEN WARNED.

# ServerRoot setting

#SERVERROOT=/usr/lib/apache2

# Configuration file location

# - If this does NOT start with a '/', then it is treated relative to

# $SERVERROOT by Apache

#CONFIGFILE=/etc/apache2/httpd.conf

# Location to log startup errors to

# They are normally dumped to your terminal.

#STARTUPERRORLOG="/var/log/apache2/startuperror.log"

# Environment variables to keep

# All environment variables are cleared from apache

# Use this to preserve some of them

# NOTE!!! It's very important that this contains PATH

# Also, it will fail if the _value_ of any of these variables contains a space

KEEPENV="PATH"

```

So basically now I am getting a whole heap of 404 errors.  I have had a look in /var/log/apache/ in the error log and this is what i get.

[Thu Feb 08 11:07:08 2007] [error] [client 127.0.0.1] File does not exist: /usr/htdocs

[Thu Feb 08 11:08:08 2007] [error] [client 127.0.0.1] File does not exist: /usr/htdocs

[Thu Feb 08 11:09:08 2007] [error] [client 127.0.0.1] File does not exist: /usr/htdocs

[Thu Feb 08 11:10:08 2007] [error] [client 127.0.0.1] File does not exist: /usr/htdocs

[Thu Feb 08 11:11:08 2007] [error] [client 127.0.0.1] File does not exist: /usr/htdocs

[Thu Feb 08 11:12:08 2007] [error] [client 127.0.0.1] File does not exist: /usr/htdocs

I don't see why it should be referring to /usr/htdocs.  I have changed everything i can think of.

----------

## paul7v7

ok added a directory /usr/htdocs to see what would happen and now i don't get the 404 error but a directory listing of that folder it seems.  Just have to find out why and where it is referring to that folder.  It seems that the document root is /usr/htdoc even though i have specified in the config files that it is /mnt/website/forum.  Is there anywhere besides the default vhost config file in vhost.d and the httpd.conf that i should be looking?  

So basically apache and php work now BUT i can't seem to be able to change the document root for apache.

----------

## c4

paul7v7, I would suggest that you do the following:

move or create a new backup of you apache config files in /etc/apache2 and than start with fresh new files.

Second, I would keep your httpd.conf basically as the standard-default file is, just change the 

```
ServerName paul7v7s-forum.org
```

 under the section 2 part. My guess is that you want this to be whatever your default vhost will be. The serverroot settings at the top are not generally suppost to be edited, so let it remain as 

```
ServerRoot "/usr/lib/apache2"
```

 they affect other things than your document root.

Then at the bottom of your httpd.conf, add you vhosts with 

```
## Gentoo VHosts

# 

# For Gentoo we include External Virtual Hosts Files.

#

Include conf/vhosts.d/00_default_vhost.conf
```

After that, have a look at 00_default_vhost.conf, and edit it like such:

```
#

# Use name-based virtual hosting.

#

NameVirtualHost *:80

<VirtualHost *:80>

ServerName paul7v7s-forum.org 

ServerAlias *.paul7v7s-forum.org 

    DocumentRoot "/mnt/website/forum"

    DirectoryIndex index.php

    <Directory "/mnt/website/forum">

        AllowOverride None

        Order allow,deny

        Allow from all

    </Directory>

</VirtualHost>

```

That should do it, and keeping that certain vhost at the top of you vhost file will make it your default vhost.

add more vhosts by adding simular blocks underneith in your 00_default_vhost.conf file. (like this-->

```
<VirtualHost *:80>

ServerName another-vhost.com 

ServerAlias *.another-vhost.com 

    DocumentRoot "/mnt/website/another-vhost"

    DirectoryIndex index.php

    <Directory "/mnt/website/another-vhost">

        AllowOverride None

        Order allow,deny

        Allow from all

    </Directory>

</VirtualHost>
```

Finally this is what /etc/conf.d/apache2 looks like for another gentoo-server I checked:

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

KEEPENV="PATH"
```

Adjust this to also include -D USERDIR and see if this all works. Good Luck!

----------

## paul7v7

C4, mate i appreciate all the help you have given me.  looks to be working so far, just sorting some issues with the index.php but other than that it looks to be going well.  Really appreciate the help.

----------

