Red Hat Bugzilla – Bug 218082
Virtual hosts do not fit in well the current structure of /var/www
Last modified: 2007-11-30 17:07:38 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-/
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
Also Apache should do logging as /var/log/apache/-hostname-.com.access.log
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
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.
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.