Bug 218082 - Virtual hosts do not fit in well the current structure of /var/www
Virtual hosts do not fit in well the current structure of /var/www
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: httpd (Show other bugs)
All Linux
medium Severity low
: ---
: ---
Assigned To: Joe Orton
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2006-12-01 13:51 EST by James Olson
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-12-12 05:31:45 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description James Olson 2006-12-01 13:51:26 EST
Description of problem:
virtual hosts do not fit in well the current structure of /var/www

Steps to Reproduce:
1. Create a virtual host.
2. Find /var/www unsuitable.
3. Place www-root in /home/-vhostname.com-/
4. This creates problem with php and cgi if /home has a special file system
mounts for no-exec user dirs.
5. Create some other ugly location like /opt/vhosts/-vhostname.com-/

Additional info:
It may have been proposed before but does /var/www/-hostname-/html make more
sense? Naturally you can do this yourself, but you have to rewrite the entire
Apache default config and none of the packages (webalizer) are designed to work
this way.

Also Apache should do logging as /var/log/apache/-hostname-.com.access.log
Comment 1 Joe Orton 2006-12-11 12:56:40 EST
It's not clear exactly what problem you are reporting here.

You can certainly create document roots for vhosts under /var/www if you
configure them that way.  You don't have to rewrite "the entire Apache default
config" to do so: just put "DocumentRoot /var/www/myvhost" in the VirtualHost block.

You can use the mod_vhost_alias to have the docroot for a  name-based-vhosts
automatically derived from the hostname used, if that's what you are looking for.

Could you clarify exactly what change to the default configuration you are
Comment 2 James Olson 2006-12-11 20:31:02 EST
The problem is wishlist priority.

Seems to me it would be a good idea to make the default root look like this.
The below example is the main root directory, the html directory, scripts
directory, and a package install point location.

/var/www/localhost/cgi-bin -> /usr/lib/cgi-bin (link)
/var/www/localhost/phpmyadmin -> /usr/share/phpmyadmin (link)

This logs to /var/logs/apache/localhost.access.log

Then when you add a virtual host, say example.com
/var/www/example.com/cgi-bin -> /usr/lib/cgi-bin (link)
/var/www/example.com/phpmyadmin -> /usr/share/phpmyadmin (link)

This logs to /var/logs/apache/example.com.access.log

Debian does part of this, only they use /var/www/apache2-default/ but they don't
change the log files to sort logs by hostname. This setup would make it easier
to setup a web server with lots of virtual hosts by just adding the directory
and the links to any packages you would want.
Comment 3 Joe Orton 2006-12-12 05:31:45 EST
Not everybody uses virtual hosts; for those who don't, such a structure just
adds a redundant extra directory level.  I don't see a strong motivation to
change the default; changing the default directory layout as suggested means
everybody incurs a migration cost.

Thanks for the suggestion.

Note You need to log in before you can comment on or make changes to this bug.