# [SOLVED] apache virtual hosting doesn't works

## RealNoob

Hi,

I am trying to configure apache for virtual hosting, I have currently 2 virtual hosts located as follow:

/var/www/localhost/htdocs/vhost/www.inttest.isidor.arg/

/var/www/localhost/htdocs/vhost/www4.inttest.isidor.arg/

I found the following thread with a similar problem but it doesn't help:

https://forums.gentoo.org/viewtopic-t-819935.html

www.inttest.isidor.arg and www4.inttest.isidor.arg are defined in a DNS inside the intranet of the company I am working for.

looking at the log, I found the following line:

```
[Tue Feb 22 10:40:17 2011] [error] [client 192.168.50.50] client denied by server configuration: /var/www/localhost/htdocs/vhosts
```

Given the configuration provided below, what can I have down wrong?

Below is the httpd.conf:

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

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

User apache

Group apache

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

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

```

Next is the content of /etc/apache2/modules.d/00_default_settings.conf

```

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

UseCanonicalName Off

AccessFileName .htaccess

ServerTokens Prod

TraceEnable off

ServerSignature On

HostnameLookups Off

ErrorLog /var/log/apache2/error_log

LogLevel warn

<Directory />

        Options FollowSymLinks

        AllowOverride None

        Order deny,allow

        Deny from all

</Directory>

<IfModule dir_module>

        DirectoryIndex index.html index.html.var

</IfModule>

<FilesMatch "^\.ht">

        Order allow,deny

        Deny from all

</FilesMatch>

VirtualDocumentRoot /var/www/localhost/htdocs/vhosts/%0

```

Here is the content of /etc/apache2/vhosts.d/00_testreve2_vhost.conf:

```
<IfDefine REVEHOST2_VHOST>

Listen 80

NameVirtualHost *:80

<VirtualHost *:80>

        ServerName www.inttest.isidor.arg

        DocumentRoot "/var/www/localhost/htdocs/vhost/www.inttest.isidor.arg"

        <Directory "/var/www/localhost/htdocs/vhost/www.inttest.isidor.arg">

                Order deny,allow

                Allow from all

        </Directory>

        <IfModule mpm_peruser_module>

                ServerEnvironment apache apache

        </IfModule>

</VirtualHost>

<VirtualHost *:80>

        ServerName www4.inttest.isidor.arg

        DocumentRoot "/var/www/localhost/htdocs/vhost/www4.inttest.isidor.arg"

        <Directory "/var/www/localhost/htdocs/vhost/www4.inttest.isidor.arg">

                Order deny,allow

                Allow from all

        </Directory>

        <IfModule mpm_peruser_module>

                ServerEnvironment apache apache

        </IfModule>

</VirtualHost>

</IfDefine>

```

Finally, below is the content of the file /etc/conf.d/apache2:

```
APACHE2_OPTS="-D REVEHOST2_VHOST -D INFO -D LANGUAGE -D PHP5"
```

If I use the default VHOST configuration file, it works flawlessly. Additionally, ownership is set to the user and group apache from /var/www.

Does anyone have a clue what I did wrong in my configuration?

Thanks for your help.

----------

## slis

Hi,

I don't know, if you misspelled something here, or in your conf files. Your log file says that:

```
client denied by server configuration: /var/www/localhost/htdocs/vhosts
```

but in your conf, you've got:

```

DocumentRoot "/var/www/localhost/htdocs/vhost/www.inttest.isidor.arg" 

        <Directory "/var/www/localhost/htdocs/vhost/www.inttest.isidor.arg"> 

[...]

```

I mean: vhosts vs vhost.

Try check that.

Regards

----------

## RealNoob

Welcome to my nightmare...speeeeeelling   :Evil or Very Mad: 

The VirtualDocumentRoot directive was wrong   :Embarassed: 

Many thanks, case solved.

----------

