# Gentoo does not use 'standard' conf for apache?

## dE_logics

The config for Gentoo is located in /etc/conf.d/apache2... however the format doest appear to be the one that apache reads directly (with the -f option). Is this true?... I mean where're the 'sections' in the apache config?

----------

## tomk

The config for the Apache initscript is found in /etc/conf.d/apache2. The actual Apache config is in /etc/apache2.

----------

## dE_logics

Where in /etc/apache2? Does this config gets read?

Where can I get a manual or something for /etc/conf.d/apache2 with all it's options?

----------

## tomk

 *dE_logics wrote:*   

> Where in /etc/apache2? Does this config gets read?

 

The main configuration file is /etc/apache2/httpd.conf which is the one that is read by Apache using the -f option. Module-specific configuration files are found in /etc/apache2/modules.d/ and loaded based on what is specified in the APACHE2_OPTS variable in /etc/conf.d/apache2. Virtual host config is in /etc/apache2/vhosts.d/.

 *dE_logics wrote:*   

> Where can I get a manual or something for /etc/conf.d/apache2 with all it's options?

 

There isn't any documentation that explains all the options in /etc/conf.d/apache2 but the comments in the file are pretty comprehensive. Usually the only option you'd want to modify in there is APACHE2_OPTS which is explained in the Troubleshooting Apache document.

----------

## dE_logics

Thanks... trying it out.

But there isn't an -f option like there used to be some day - 

```
Options: [dDsvl:ZChqv]

  -d, --debug                       set xtrace when running the script

  -Z, --dry-run                     show what would be done

  -s, --ifstarted                   only run commands when started

  -D, --nodeps                      ignore dependencies

  -l, --lockfd <arg>                fd of the exclusive lock from rc

  -h, --help                        Display this help output

  -C, --nocolor                     Disable color output

  -v, --verbose                     Run verbosely

  -q, --quiet                       Run quietly
```

----------

## dE_logics

Well, the apache rc script does read httpd.conf... it parses notifies the misconfiguration in them, but when I set DocumentRoot /home/de/http which contains webpages, it just shows 'It works!'. I know I can define this variable in conf.d/apache2, but how to do it using httpd.conf?

----------

## tomk

The 'It works!' message comes from the default vhost which is found in /var/www/localhost/ and is configured in /etc/apache2/vhosts.d/00_default_vhost.conf and /etc/apache2/vhosts.d/default_vhost.include. You can either edit these files or add your own vhost config file to /etc/apache2/vhosts.d/.

----------

## dE_logics

I want to host certain webpages in /home/de/http, I can configure apache to do so through /etc/conf.d/apache2 but not by placing DocumentRoot /home/de/http in httpd.conf... I want to do the latter.

I do not want virtual hosting currently.

----------

## dE_logics

Ok, so, Gentoo is not used as web servers....

No wonder there're only a few people around.

----------

## dE_logics

Really, this is confusing.

What if I want to just shut off virtual hosts completely... I mean, I don't seem to use it, it's just one website that I wanna host so I should not be using this thing absolutely.

----------

## Anon-E-moose

I like using virtual hosts, so that I can separate out hitting the site internally via 127.* versus the open side.

If you want to point the directory somewhere else than /var/www/* then use 

DocumentRoot /<some other directory>

It's been the way to set a non default path for a long time in apache.

----------

## M

So turn it off then, don't set -D DEFAULT_VHOST in conf.d/apache2, you can copy default_vhost.include somewhere to have config as a base and include it in httpd.conf or just set it in httpd.conf. If you look at the httpd.conf at the end of the file you will see that it includes this

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

and this 

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

You can always move config from modules.d into one big httpd.conf if you prefer that, comment line that includes all files from vhosts.d if you don't want that.

----------

## tomk

 *dE_logics wrote:*   

> Ok, so, Gentoo is not used as web servers....

 

Of course it is, you wouldn't be posting this if it wasn't  :Smile:  If anything Gentoo makes it easier to configure Apache than other distributions especially for options that people frequently use such as virtual hosts.

 *dE_logics wrote:*   

> What if I want to just shut off virtual hosts completely... I mean, I don't seem to use it, it's just one website that I wanna host so I should not be using this thing absolutely.

 

 *M wrote:*   

> So turn it off then, don't set -D DEFAULT_VHOST in conf.d/apache2, you can copy default_vhost.include somewhere to have config as a base and include it in httpd.conf or just set it in httpd.conf.

 

The important thing to consider when disabling DEFAULT_VHOST and SSL_DEFAULT_VHOST is to include a Listen directive (as mentioned in the comments in /etc/conf.d/apache2) otherwise it won't work.

If you just want to host some pages in your home directory the easiest way is to include "-D USERDIR" to APACHE2_OPTS then add the files to ~/public_html/ which will automatically be available from http://yourhost/~youruser/

----------

## dE_logics

 *Anon-E-moose wrote:*   

> I like using virtual hosts, so that I can separate out hitting the site internally via 127.* versus the open side.
> 
> If you want to point the directory somewhere else than /var/www/* then use 
> 
> DocumentRoot /<some other directory>
> ...

 

Yeah, I know, but that's not working, that's the issue - 

 *dE wrote:*   

> I want to host certain webpages in /home/de/http, I can configure apache to do so through /etc/conf.d/apache2 but not by placing DocumentRoot /home/de/http in httpd.conf... I want to do the latter. 

 

So, virtual hosting is also capable of differentiating between localhost and any external client? Or I think that Apache works around the principle of virtual hosts... i.e. even if I'm hosting a single website on an IP, it'll be hosted using a single virtual host. Is this so? And we can set individual sets of webpages for each virtual host. So what does DocumentRoot do?

Whatever it is, virtual hosting is mandatory, you can't omit it, otherwise nothing works; so what's with this thing? What's going on? Is it that virtual hosting is suppose to resolve localhost to localhost:80? Can I get some modern reference to this (I don't understand where to start with the official docs)?

----------

## baaann

This may help?

http://en.gentoo-wiki.com/wiki/Apache2/Virtual_Hosts

----------

## Anon-E-moose

 *dE_logics wrote:*   

> So, virtual hosting is also capable of differentiating between localhost and any external client? Or I think that Apache works around the principle of virtual hosts... i.e. even if I'm hosting a single website on an IP, it'll be hosted using a single virtual host. Is this so? And we can set individual sets of webpages for each virtual host. So what does DocumentRoot do?
> 
> Whatever it is, virtual hosting is mandatory, you can't omit it, otherwise nothing works; so what's with this thing? What's going on? Is it that virtual hosting is suppose to resolve localhost to localhost:80? Can I get some modern reference to this (I don't understand where to start with the official docs)?

 

This is a copy of my 00_default_vhost.conf file minus blank lines and comments

```
<IfDefine DEFAULT_VHOST>

Listen 8080

NameVirtualHost *:8080

SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog

<VirtualHost *:8080>

    ServerName localhost

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

    <IfModule mpm_peruser_module>

        ServerEnvironment apache apache

    </IfModule>

</VirtualHost>

</IfDefine>

```

I am listening on port 8080 instead of 80, not logging anything relating to localhost, server called "localhost"

it uses the default directory /var/www/localhost

I also have a domain name, that I serve a few pages from

```
<VirtualHost www.mysite.com:8080>

    ServerName www.mysite.com

    ServerAlias mysite

    SetOutputFilter DEFLATE

    AddOutputFilterByType DEFLATE text/html text/plain text/xml

    # enable expirations

    ExpiresActive On

    ExpiresDefault "access plus 1 day"

    # expire GIF images after a month in the client's cache

    ExpiresByType image/gif A2592000

    DocumentRoot /var/www/mysite/htdocs

    <Directory "/var/www/mysite/htdocs">

        # Some sane defaults - see httpd.conf for details

        Options Indexes FollowSymLinks

        AllowOverride None

        Order allow,deny

        Allow from all

    </Directory>

    ScriptAlias /cgi-bin "/var/www/mysite/cgi-bin"

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

        AllowOverride None

        Options None

        Order allow,deny

        Allow from all

    </Directory>

</VirtualHost>   
```

it also looks at port 8080, but it only looks for things coming in with www.mysite.com:8080

I set my server name, the DocumentRoot is set to be an area where I keep files for

that server alone, and I set directories for document files and scripts.

It works well for me.

----------

## Corona688

 *dE_logics wrote:*   

> Ok, so, Gentoo is not used as web servers....
> 
> No wonder there're only a few people around.

  The forums are slow, and you didn't even wait 2 hours between posting the question and throwing insults.  If you're that impatient have you tried the IRC?  I've found it to be quite busy as IRC channels go.

Yes, virtual hosting is capable of telling what name your site is loaded as.  This is so you can host webpages from many different domain names on one server, and was added to the standard with HTTP 1.1.  Meaning, quite a long time ago.  You should be able to just add your own virtualhost for your specific website and access it by hostname.

```
# Put in /etc/apache2/vhosts.d/02-mysite.conf

<VirtualHost *:80>

        ServerName mysite.com

        DocumentRoot /path/to/whatever

</VirtualHost>
```

The reason they've broken apache2 config files into 'include' files under /etc/apache2/vhosts.d/ is so the main config file can be replaced/updated without disturbing your custom settings.  I've seen it done like this in other distros, I don't think it's anything really special to gentoo.  And the things in /etc/conf.d/apache2 are mostly just definition flags that're passed to the config files.  When you see "<IfDefine DEFAULT_VHOST>" in a config file, that section is only processed if DEFAULT_VHOST is set in /etc/conf.d/apache2.

----------

## dE_logics

You know, this is about virtual host, my actually question if stated explicitly is - 

"Why is setting virtualhost mandatory to get apache working?"

I'll do virtual hosting later after I do the basics. If I set Listen *:80 and comment out all the virtual hosting lines, then I get permission denied (even if I goto http://localhost:80).

----------

## AllenJB

VirtualHost is the default setup because it's what (probably) 99% of people using Apache use.

You don't have to use a VirtualHost based setup, it's just the default.

If you comment out all of the VirtualHost blocks, then you must have a "DocumentRoot" entry in the main config, pointing to where you want Apache to serve from and ensure that Apache is set up to allow serving from it. (See /etc/apache2/vhosts.d/default_vhost.include - note the Directory blocks - without the Order/Allow directives in these, Apache will not allow files to be served from these directories).

On the filesystem side, the Apache user must have read permissions on all files and additionally execute permissions on directories.

----------

## Anon-E-moose

What AllenJB said is correct, you don't have to use virtual hosts

in /etc/apache2/httpd.conf comment out

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

and add

```
DocumentRoot "<path to files to be served>"

Listen 80

<Directory />

    Options FollowSymLinks

    AllowOverride All

</Directory>

```

Change Listen directive to whatever port you want to listen to

Pay attention to permissions of where DocumentRoot points to both files and directory

Change options in Directory block to be what you want

And as always there's the official docs http://httpd.apache.org/docs/2.0/

----------

## dE_logics

I still get forbidden...

----------

## Anon-E-moose

 *dE_logics wrote:*   

> I still get forbidden...

 

what is the whole message, in context?

What does the error log "/var/log/apache2/error_log" say?

----------

## dE_logics

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

apache2         | * Starting apache2 ...

apache2         |apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
```

error log - 

```
[Wed Sep 08 02:57:45 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Wed Sep 08 03:00:11 2010] [notice] caught SIGTERM, shutting down

[Wed Sep 08 03:00:14 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Wed Sep 08 03:00:25 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Wed Sep 08 03:00:28 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Wed Sep 08 03:02:16 2010] [error] [client 127.0.0.1] (13)Permission denied: file permissions deny server access: /var/www/localhost/htdocs/index.html

[Wed Sep 08 03:03:20 2010] [notice] caught SIGTERM, shutting down

[Thu Sep 09 01:39:39 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Thu Sep 09 01:40:51 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Thu Sep 09 01:40:51 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Thu Sep 09 01:40:51 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Thu Sep 09 01:40:57 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/Java_ebook, referer: http://localhost/Java_ebook/docs.rinet.ru/PublicPauk/index.html

[Thu Sep 09 01:41:17 2010] [notice] caught SIGTERM, shutting down

[Thu Sep 09 01:45:58 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Thu Sep 09 01:46:06 2010] [notice] caught SIGTERM, shutting down

[Thu Sep 09 06:04:44 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Thu Sep 09 06:05:12 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Thu Sep 09 06:05:12 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Thu Sep 09 06:05:12 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Thu Sep 09 06:05:54 2010] [notice] caught SIGTERM, shutting down

[Thu Sep 09 09:10:05 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Thu Sep 09 09:10:27 2010] [notice] caught SIGTERM, shutting down

[Thu Sep 09 09:14:26 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Thu Sep 09 09:20:23 2010] [notice] caught SIGTERM, shutting down

[Thu Sep 09 09:23:47 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Thu Sep 09 09:25:47 2010] [notice] caught SIGTERM, shutting down

[Thu Sep 09 09:25:49 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Thu Sep 09 10:30:19 2010] [notice] caught SIGTERM, shutting down

[Thu Sep 09 16:26:08 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Thu Sep 09 16:28:36 2010] [error] [client 192.168.1.3] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Thu Sep 09 16:32:22 2010] [notice] caught SIGTERM, shutting down

[Fri Sep 10 20:01:16 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Fri Sep 10 20:01:48 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Fri Sep 10 20:01:51 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Fri Sep 10 20:01:59 2010] [notice] caught SIGTERM, shutting down

[Fri Sep 10 20:03:36 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Fri Sep 10 20:06:21 2010] [notice] caught SIGTERM, shutting down

[Fri Sep 10 20:10:18 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Fri Sep 10 20:10:23 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/

[Fri Sep 10 20:10:24 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/

[Fri Sep 10 20:10:29 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/

[Fri Sep 10 20:14:38 2010] [error] [client 192.168.1.3] client denied by server configuration: /home/de/http/

[Fri Sep 10 20:14:38 2010] [error] [client 192.168.1.3] (13)Permission denied: access to /favicon.ico denied

[Fri Sep 10 20:14:41 2010] [error] [client 192.168.1.3] (13)Permission denied: access to /favicon.ico denied

[Fri Sep 10 20:14:46 2010] [error] [client 192.168.1.3] client denied by server configuration: /home/de/http/

[Fri Sep 10 20:30:45 2010] [notice] caught SIGTERM, shutting down

[Sat Sep 11 13:02:24 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Sat Sep 11 13:02:54 2010] [notice] caught SIGTERM, shutting down

[Sat Sep 11 13:03:16 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Sat Sep 11 13:03:18 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/

[Sat Sep 11 13:03:21 2010] [error] [client 127.0.0.1] (13)Permission denied: access to /favicon.ico denied

[Sat Sep 11 13:03:40 2010] [notice] caught SIGTERM, shutting down

[Sat Sep 11 13:03:42 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Sat Sep 11 13:03:44 2010] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Sat Sep 11 13:03:44 2010] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Sat Sep 11 13:03:45 2010] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Sat Sep 11 13:03:45 2010] [error] [client 127.0.0.1] client denied by server configuration: /usr/htdocs

[Sat Sep 11 13:05:18 2010] [notice] caught SIGTERM, shutting down

[Sat Sep 11 13:05:20 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Sat Sep 11 13:05:25 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/

[Sat Sep 11 13:05:25 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/

[Sat Sep 11 13:05:26 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/

[Sat Sep 11 13:06:39 2010] [notice] caught SIGTERM, shutting down

[Sat Sep 11 17:51:27 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Sat Sep 11 17:51:44 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/

[Sat Sep 11 17:51:46 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/

[Sat Sep 11 17:51:47 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/favicon.ico

[Sat Sep 11 17:51:47 2010] [error] [client 127.0.0.1] client denied by server configuration: /home/de/http/favicon.ico

[Sat Sep 11 17:53:05 2010] [notice] caught SIGTERM, shutting down

[Sat Sep 11 17:53:08 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Sat Sep 11 17:53:10 2010] [error] [client 127.0.0.1] (13)Permission denied: access to / denied

[Sat Sep 11 17:53:10 2010] [error] [client 127.0.0.1] (13)Permission denied: access to / denied

[Sat Sep 11 17:53:10 2010] [error] [client 127.0.0.1] (13)Permission denied: access to / denied

[Sat Sep 11 17:53:11 2010] [error] [client 127.0.0.1] (13)Permission denied: access to / denied

[Sat Sep 11 17:53:11 2010] [error] [client 127.0.0.1] (13)Permission denied: access to / denied

[Sat Sep 11 17:53:11 2010] [error] [client 127.0.0.1] (13)Permission denied: access to / denied

[Sat Sep 11 17:53:11 2010] [error] [client 127.0.0.1] (13)Permission denied: access to / denied

[Sat Sep 11 17:53:47 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

[Sat Sep 11 17:53:48 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

[Sat Sep 11 17:53:48 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

[Sat Sep 11 17:53:50 2010] [notice] caught SIGTERM, shutting down

[Sat Sep 11 17:53:53 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Sat Sep 11 17:53:56 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

[Sat Sep 11 17:53:56 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

[Sat Sep 11 17:53:56 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

[Sat Sep 11 17:53:57 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

[Sat Sep 11 17:53:57 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

[Sat Sep 11 17:55:05 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

[Sat Sep 11 17:55:23 2010] [notice] caught SIGTERM, shutting down

[Sat Sep 11 18:26:58 2010] [notice] Apache/2.2.15 (Unix) configured -- resuming normal operations

[Sat Sep 11 18:27:22 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

[Sat Sep 11 18:27:22 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/favicon.ico

[Sat Sep 11 18:27:25 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/favicon.ico

[Sat Sep 11 18:27:27 2010] [error] [client 127.0.0.1] client denied by server configuration: /mnt/cdrom/http/

```

httpd.conf - 

```
# This is a modification of the default Apache 2.2 configuration file

# for Gentoo Linux.

#

# Support:

#   http://www.gentoo.org/main/en/lists.xml   [mailing lists]

#   http://forums.gentoo.org/                 [web forums]

#   irc://irc.freenode.net#gentoo-apache      [irc chat]

#

# Bug Reports:

#   http://bugs.gentoo.org                    [gentoo related bugs]

#   http://httpd.apache.org/bug_report.html   [apache httpd related bugs]

#

#

# This is the main Apache HTTP server configuration file.  It contains the

# configuration directives that give the server its instructions.

# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.

# In particular, see

# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>

# for a discussion of each configuration directive.

#

# Do NOT simply read the instructions in here without understanding

# what they do.  They're here only as hints or reminders.  If you are unsure

# consult the online docs. You have been warned.

#

# Configuration and logfile names: If the filenames you specify for many

# of the server's control files begin with "/" (or "drive:/" for Win32), the

# server will use that explicit path.  If the filenames do *not* begin

# with "/", the value of ServerRoot is prepended -- so "var/log/apache2/foo_log"

# with ServerRoot set to "/usr" will be interpreted by the

# server as "/usr/var/log/apache2/foo.log".

# ServerRoot: The top of the directory tree under which the server's

# configuration, error, and log files are kept.

#

# Do not add a slash at the end of the directory path.  If you point

# ServerRoot at a non-local disk, be sure to point the LockFile directive

# at a local disk.  If you wish to share the same ServerRoot for multiple

# httpd daemons, you will need to change at least LockFile and PidFile.

ServerRoot "/usr/lib64/apache2"

# 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.

#

# Example:

# LoadModule foo_module modules/mod_foo.so

#

# GENTOO: Automatically defined based on APACHE2_MODULES USE_EXPAND variable.

#         Do not change manually, it will be overwritten on upgrade.

#

# 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.

#

# Change these at your own risk!

LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

LoadModule auth_basic_module modules/mod_auth_basic.so

LoadModule authn_alias_module modules/mod_authn_alias.so

LoadModule authn_anon_module modules/mod_authn_anon.so

LoadModule authn_dbm_module modules/mod_authn_dbm.so

LoadModule authn_default_module modules/mod_authn_default.so

LoadModule authn_file_module modules/mod_authn_file.so

LoadModule authz_dbm_module modules/mod_authz_dbm.so

LoadModule authz_default_module modules/mod_authz_default.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_owner_module modules/mod_authz_owner.so

LoadModule authz_user_module modules/mod_authz_user.so

LoadModule autoindex_module modules/mod_autoindex.so

<IfDefine CACHE>

LoadModule cache_module modules/mod_cache.so

</IfDefine>

LoadModule cgi_module modules/mod_cgi.so

LoadModule cgid_module modules/mod_cgid.so

<IfDefine DAV>

LoadModule dav_module modules/mod_dav.so

</IfDefine>

<IfDefine DAV>

LoadModule dav_fs_module modules/mod_dav_fs.so

</IfDefine>

<IfDefine DAV>

LoadModule dav_lock_module modules/mod_dav_lock.so

</IfDefine>

LoadModule deflate_module modules/mod_deflate.so

LoadModule dir_module modules/mod_dir.so

<IfDefine CACHE>

LoadModule disk_cache_module modules/mod_disk_cache.so

</IfDefine>

LoadModule env_module modules/mod_env.so

LoadModule expires_module modules/mod_expires.so

LoadModule ext_filter_module modules/mod_ext_filter.so

<IfDefine CACHE>

LoadModule file_cache_module modules/mod_file_cache.so

</IfDefine>

LoadModule filter_module modules/mod_filter.so

LoadModule headers_module modules/mod_headers.so

LoadModule include_module modules/mod_include.so

<IfDefine INFO>

LoadModule info_module modules/mod_info.so

</IfDefine>

LoadModule log_config_module modules/mod_log_config.so

LoadModule logio_module modules/mod_logio.so

<IfDefine CACHE>

LoadModule mem_cache_module modules/mod_mem_cache.so

</IfDefine>

LoadModule mime_module modules/mod_mime.so

LoadModule mime_magic_module modules/mod_mime_magic.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule speling_module modules/mod_speling.so

<IfDefine SSL>

LoadModule ssl_module modules/mod_ssl.so

</IfDefine>

<IfDefine STATUS>

LoadModule status_module modules/mod_status.so

</IfDefine>

LoadModule unique_id_module modules/mod_unique_id.so

<IfDefine USERDIR>

LoadModule userdir_module modules/mod_userdir.so

</IfDefine>

LoadModule usertrack_module modules/mod_usertrack.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

# 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.

# It is usually good practice to create a dedicated user and group for

# running httpd, as with most system services.

User apache

Group apache

# Supplemental configuration

#

# Most of the configuration files in the /etc/apache2/modules.d/ directory can

# be turned on using APACHE2_OPTS in /etc/conf.d/apache2 to add extra features

# or to modify the default configuration of the server.

#

# To know which flag to add to APACHE2_OPTS, look at the first line of the

# the file, which will usually be an <IfDefine OPTION> where OPTION is the

# flag to use.

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

# Virtual-host support

#

# Gentoo has made using virtual-hosts easy. In /etc/apache2/vhosts.d/ we

# include a default vhost (enabled by adding -D DEFAULT_VHOST to

# APACHE2_OPTS in /etc/conf.d/apache2).

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

ServerAdmin de.logics@gmail.com

DocumentRoot /mnt/cdrom/http/

Listen 80

# vim: ts=4 filetype=apache
```

Sorry I couldn't strip the comments, for some reason cat apache2 |grep --invert-match ^# results in - 

```

```

----------

## Anon-E-moose

Try adding 

```
<Directory "/mnt/cdrom/http">

Options FollowSymLinks

AllowOverride None

Order deny,allow

Allow from all

</Directory>
```

to the httpd.conf file 

I use 

```
grep -vE "^#|^[ \t]*$" <filename>
```

for filtering out comments and blank lines

----------

## dE_logics

So what is this suppose to do?

A few guesses. Apart from the abvious things that make sense - 

AllowOverride None -- I have no idea what's this.

Order deny,allow -- Had to do with hosts.allow/deny?

Allow from all -- I can use 192.168.1.* etc...

----------

## AllenJB

 *dE_logics wrote:*   

> So what is this suppose to do?
> 
> A few guesses. Apart from the abvious things that make sense - 
> 
> AllowOverride None -- I have no idea what's this.
> ...

 

AllowOverride relates to what configuration settings any .htaccess files under that directory tree can affect. See the Apache documentation for full details.

Order / Allow / Deny allow control over who can see the contents of the directory tree. Again, see the documentation for full details. By default, Apache is basically set up so that it will not serve files from anywhere on the filesystem excet for the default VirtualHost location. You then have to allow the directory trees you want. This default setup is a security measure so that, for example, someone can't use a trick or two and get apache to serve up the /etc/shadow and /etc/passwd files (which would then allow them to johntheripper all your users passwords, including root and the users who are allowed to login via ssh).

As an aside, the Order / Allow / Deny settings are also why web applications should ideally keep their configuration files outside the DocumentRoot - it prevents people from using similar tricks to serve up the configuration file, giving away the database access details or default passwords (which in most cases will probably just result in your website being defaced or filled with spam, but in the case of an online shop could result in the compromise of private details, even credit cards if those are being stored)

----------

## Anon-E-moose

 *dE_logics wrote:*   

> So what is this suppose to do?

 

http://httpd.apache.org/docs/2.0/[/url]

In the middle of the page is a users guide

within that section is a configuration sections

where the different options are explained.

----------

## dE_logics

Thanks. Apart from the official docs, I got a few books too.

----------

## chris.c.hogan

With vhosts disabled (as talked about in this thread), how do you get webapp-config to work?

I have my document root set to "/srv/www/htdocs". Apache is happy serving stuff from here. This box is my Mythtv backend. I wanted to install mythweb. I edited "/etc/vhosts/webapp-config" so that 'vhost_root="/srv/www/"'. However, all "webapp-config -I -u root -d /mythweb mythweb 0.23.1_p25396" does is create an empty folder call "error" in "/srv/www". If I reconfigure everything to use "/var/www/localhost" then mythweb correctly installs in "/var/www/localhost/htdocs/mythweb".

The server is only available to my internal network. I'd like the same pages/applications available regardless of where the connection is coming from.

Thanks for any pointers!

Chris

----------

