Bug 218082

Summary: Virtual hosts do not fit in well the current structure of /var/www
Product: Red Hat Enterprise Linux 5 Reporter: James Olson <olsonjamesd>
Component: httpdAssignee: Joe Orton <jorton>
Status: CLOSED WONTFIX QA Contact: David Lawrence <dkl>
Severity: low Docs Contact:
Priority: medium    
Version: 5.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-12-12 10:31:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description James Olson 2006-12-01 18:51:26 UTC
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 17:56:40 UTC
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
proposing?

Comment 2 James Olson 2006-12-12 01:31:02 UTC
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/ 
/var/www/localhost/html
/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/
/var/www/example.com/html
/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 10:31:45 UTC
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.