You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Lampa <la...@gmail.com> on 2009/03/26 20:00:59 UTC

[users@httpd] mod_vhost_alias and DOCUMENT_ROOT

Hello,

on my one server i've compiled (first tried from packages) httpd
2.2.11 (then tried 2.2.6). With following configuration:

ServerRoot "/usr/local/httpd-2.2.6"

Listen 8080

LoadModule php5_module modules/libphp5.so

User www-data
Group www-data

HostnameLookups On

Timeout 300
KeepAlive On
MaxKeepAliveRequests 500
KeepAliveTimeout 5
UseCanonicalName Off
AccessFileName .htaccess
ServerTokens Full
ServerSignature Off
#EnableSendfile Off
PidFile logs/httpd.pid
LockFile logs/accept.lock

StartServers          5
MinSpareServers       5
MaxSpareServers      25
MaxClients          250
MaxRequestsPerChild   0

DirectoryIndex index.html index.php

DefaultType text/plain

<FilesMatch "^\.ht">
   Order allow,deny
   Deny from all
   Satisfy All
</FilesMatch>

<Directory />
   Options FollowSymLinks
   AllowOverride All
   Order deny,allow
   Allow from all
</Directory>

ErrorLog "logs/error_log"
LogLevel debug
LogFormat "%V %h \"%u\" %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
TransferLog logs/other_vhosts_access.log

NameVirtualHost *:8080

AddType application/x-httpd-php .php .phtml .php3

<VirtualHost *:8080>
       ServerName domain.tld
       ServerAlias *.domain.tld

       VirtualDocumentRoot /var/www/domain.tld/home/%-3
#      DocumentRoot /tmp

       TransferLog logs/domain.tld_access.log
       ErrorLog logs/domain.tld_error.log
       LogLevel debug
</VirtualHost>

Everything woks ok (installed mod PHP). Excpet that variable
DOCUMENT_ROOT ($_SERVER['DOCUMENT_ROOT'] in php) points to /htdocs.
When use DocumentRoot variable DOCUMENT_ROOT
($_SERVER['DOCUMENT_ROOT'] in php)  points to /tmp, but pages are
loaded from correct location (depends on subdomain). What must be set
to variable DOCUMENT_ROOT ($_SERVER['DOCUMENT_ROOT'] in php) points to
right location (www.domain.tld -> /var/www/domain.tld/home/www,
xyz.domain.tld -> /var/www/domain.tld/home/xyz).

Using debian testing 64bit.

apachectl -l
Compiled in modules:
 core.c
 mod_authn_file.c
 mod_authz_host.c
 mod_authz_user.c
 mod_auth_basic.c
 mod_log_config.c
 mod_setenvif.c
 prefork.c
 http_core.c
 mod_mime.c
 mod_status.c
 mod_autoindex.c
 mod_cgi.c
 mod_vhost_alias.c
 mod_dir.c
 mod_alias.c
 mod_rewrite.c
 mod_so.c

apachectl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:8080                 is a NameVirtualHost
        default server domain.tld (/usr/local/httpd-2.2.6/conf/httpd.conf:60)
        port 8080 namevhost domain.tld
(/usr/local/httpd-2.2.6/conf/httpd.conf:60)
Syntax OK


Thank you for help and advices.

-- 
Lampa

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_vhost_alias and DOCUMENT_ROOT

Posted by Lampa <la...@gmail.com>.
Hello,

that strange, have 2 other machines where DOCUMENT_ROOT points to
right location, after migrating to new machine problem occurs

2009/3/26 Eric Covener <co...@gmail.com>:
> On Thu, Mar 26, 2009 at 3:00 PM, Lampa <la...@gmail.com> wrote:
>
>>       VirtualDocumentRoot /var/www/domain.tld/home/%-3
>
>> Everything woks ok (installed mod PHP). Excpet that variable
>> DOCUMENT_ROOT ($_SERVER['DOCUMENT_ROOT'] in php) points to /htdocs.
>
>
> VirtualDocumentRoot causes files to be served from someplace other
> than your DocumentRoot, like an Alias, so the variable doesn't change:
>
> https://issues.apache.org/bugzilla/show_bug.cgi?id=26052
>
> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>



-- 
Lampa

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_vhost_alias and DOCUMENT_ROOT

Posted by Eric Covener <co...@gmail.com>.
On Thu, Mar 26, 2009 at 3:00 PM, Lampa <la...@gmail.com> wrote:

>       VirtualDocumentRoot /var/www/domain.tld/home/%-3

> Everything woks ok (installed mod PHP). Excpet that variable
> DOCUMENT_ROOT ($_SERVER['DOCUMENT_ROOT'] in php) points to /htdocs.


VirtualDocumentRoot causes files to be served from someplace other
than your DocumentRoot, like an Alias, so the variable doesn't change:

https://issues.apache.org/bugzilla/show_bug.cgi?id=26052

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org