how to avoid duplicating the document root in vhost conf files?
how to avoid duplicating the document root in vhost conf files?
am 06.10.2009 20:37:05 von Brolin Empey
Hello list,
Here is one of my vhost conf files:
[brolin@cowboy] [0] [1] ~/
$ cat /etc/apache2/sites-available/aidsorphanage.org
ServerAdmin brolin@techsol.ca
ServerName aidsorphanage.org
ServerAlias www.aidsorphanage.org aidsorphonage.org
www.aidsorphonage.org
DocumentRoot /var/www/aidsorphanage.org/
# FIXME: How can I avoid duplicating ${DOCUMENT_ROOT}?
# - brolin, 2009-09-15
Order Deny,Allow
Deny from All
Options FollowSymLinks
AllowOverride All
ErrorLog /var/www/aidsorphanage.org/logs/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/www/aidsorphanage.org/logs/access.log combined
[brolin@cowboy] [0] [2] ~/
How can I avoid duplicating the document root after it is declared
with the DocumentRoot directive? In this example, the document root
is duplicated thrice. Duplication is bad.
I am using apache2 version 2.2.11-2ubuntu2.3.
Thanks,
Brolin
--
Sometimes I forget how to do small talk:
=93If you have to ask why, you=92re not a member of the intended
audience.=94 =97 Bob Zimbinski,
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: how to avoid duplicating the document root in vhost
am 06.10.2009 21:15:13 von Jonathan Zuckerman
On Tue, Oct 6, 2009 at 11:37 AM, Brolin Empey wrote:
> Hello list,
>
> Here is one of my vhost conf files:
>
> [brolin@cowboy] [0] [1] ~/
> $ cat /etc/apache2/sites-available/aidsorphanage.org
>
> Â Â Â Â ServerAdmin brolin@techsol.ca
> Â Â Â Â ServerName aidsorphanage.org
> Â Â Â Â ServerAlias www.aidsorphanage.org aidsorphonag=
e.org
> www.aidsorphonage.org
>
> Â Â Â Â DocumentRoot /var/www/aidsorphanage.org/
>
> # Â Â Â FIXME: How can I avoid duplicating ${DOCUMENT_ROOT=
}?
> # Â Â Â Â Â Â Â - brolin, 2009-09-15
> Â Â Â Â
> Â Â Â Â Â Â Â Â Order Deny,Allow
> Â Â Â Â Â Â Â Â Deny from All
> Â Â Â Â
>
> Â Â Â Â
> Â Â Â Â Â Â Â Â Options FollowSymL=
inks
> Â Â Â Â Â Â Â Â AllowOverride All
> Â Â Â Â
>
> Â Â Â Â ErrorLog /var/www/aidsorphanage.org/logs/error=
..log
>
> Â Â Â Â # Possible values include: debug, info, notice=
, warn, error, crit,
> Â Â Â Â # alert, emerg.
> Â Â Â Â LogLevel warn
>
> Â Â Â Â CustomLog /var/www/aidsorphanage.org/logs/acce=
ss.log combined
>
> [brolin@cowboy] [0] [2] ~/
>
> How can I avoid duplicating the document root after it is declared
> with the DocumentRoot directive? Â In this example, the document root
> is duplicated thrice. Â Duplication is bad.
>
> I am using apache2 version 2.2.11-2ubuntu2.3.
>
> Thanks,
> Brolin
>
> --
> Sometimes I forget how to do small talk:
>
> â=9CIf you have to ask why, youâ=99re not a member of the inten=
ded
> audience.â=9D â=94 Bob Zimbinski,
ttyquake/>
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project=
..
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> Â " Â from the digest: users-digest-unsubscribe@httpd.apache.or=
g
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Am I missing something? I only see the DocumentRoot declared once in
your example
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: how to avoid duplicating the document root in vhost
am 06.10.2009 21:30:23 von Brolin Empey
2009/10/6 Jonathan Zuckerman :
> Am I missing something? I only see the DocumentRoot declared once in
> your example
Yes, there is only 1 DocumentRoot directive, but the
=93/var/www/aidsorphanage.org/=94 part of the /value/ of the DocumentRoot
directive is duplicated thrice. How can I avoid duplicating this
common part of the paths in the vhost conf file?
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: how to avoid duplicating the document root in vhost
am 06.10.2009 21:55:42 von Jonathan Zuckerman
On Tue, Oct 6, 2009 at 12:30 PM, Brolin Empey wrote:
> 2009/10/6 Jonathan Zuckerman :
>> Am I missing something? I only see the DocumentRoot declared once in
>> your example
>
> Yes, there is only 1 DocumentRoot directive, but the
> â=9C/var/www/aidsorphanage.org/â=9D part of the /value/ of the =
DocumentRoot
> directive is duplicated thrice. Â How can I avoid duplicating this
> common part of the paths in the vhost conf file?
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project=
..
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> Â " Â from the digest: users-digest-unsubscribe@httpd.apache.or=
g
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Ah I see... I'm a software engineer too so I appreciate trying to
encapsulate often-used values but I'd say this might be one of those
battles it wouldn't kill you to forfeit.
That said, have you tried using relative paths for the error log path
declarations? Or (my preferred solution) put them outside the
document root; why bother putting them in the doc root and then making
a directory override to disallow outside access to them when the
simpler solution would be to just put them outside the web root and
never ever worry about access rules.
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: how to avoid duplicating the document root in vhost
am 06.10.2009 23:34:14 von Brolin Empey
2009/10/6 Jonathan Zuckerman :
> Ah I see... I'm a software engineer too so I appreciate trying to
> encapsulate often-used values but I'd say this might be one of those
> battles it wouldn't kill you to forfeit.
I am a hacker, not an engineer. ;) In any case, I am not a
professional engineer, so I would not call myself an engineer.
Anyway, did you notice my FIXME about avoiding the duplicated paths is
dated 2009-09-15? I have already deferred publicly asking about this
issue for over half a month because it is a low priority and I am
probably the only person who cares about it, but I am a perfectionist
sometimes, so I want to avoid the duplication.
> That said, have you tried using relative paths for the error log path
> declarations?
No, I have not. Since the ${DOCUMENT_ROOT} variable exists, why can I
not use it in my vhost conf file? :(
> =A0Or (my preferred solution) put them outside the
> document root; why bother putting them in the doc root and then making
> a directory override to disallow outside access to them when the
> simpler solution would be to just put them outside the web root and
> never ever worry about access rules.
I know that is a simpler and probably more logical solution, but I
kept the logs under the doc root for at least 2 reasons:
1. The Web howto about configuring apache2 vhosts on Debian/Ubuntu I
used used this config in its examples. That howto lacks credibility,
though, because it has errors (singular versus plural nouns) in the
paths to the vhost conf files and does not even prevent world/public
access to the logs! (epic fail)
2. Because my VPS is hosting multiple vhosts, I thought it was tidier
to keep the logs in the doc root. I know it does not make much sense
because the logs are not public content, but it was an arbitrary
decision: I had to keep the logs /somewhere/. Yes, I suppose
/var/log/ is a better home for apache logs than /var/www/.
I mean this completely politely, but you should trim your quotes to
include only relevant text, not entire messages, including signatures
and footers.
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: how to avoid duplicating the document root in vhost
am 07.10.2009 08:40:03 von Krist van Besien
You might want to take a look at mod_macro. Especially if you have a
lot of VHOSTS, and have them all structured in the same way.
http://www.cri.ensmp.fr/~coelho/mod_macro/
Krist
--
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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