I have some high-availability clusters with Apache on Gentoo. /var/www is a DRBD mount, but for the sake of argument, could just as easily be a SAN or NAS or NFS share. Point is that it's only ever mounted on one server - the one that's currently the master (the slave will mount it upon demand when it takes over). I also don't failed to jive with Gentoo's provided apache configuration, so I made my own (to be fair, I've never seen any distribution provide an apache configuration that was flexible enough nor as easy to understand as writing my own). So, in make.conf, I have added both /var/www and /etc/apache2 to my INSTALL_MASK. Now, when I rebuild apache on one of the slaves, it goes something like this: ... >>> Merging www-servers/apache-2.0.58-r2 to / * Removing /etc/apache2 ... * Removing /var/www ... >>> Original instance of package unmerged safely. /usr/portage/www-servers/apache/apache-2.0.58-r2.ebuild: line 320: cd: //etc/apache2/ssl: No such file or directory * * Generating self-signed test certificate in /etc/apache2/ssl... * * Installing default webroot to //var/www/localhost mkdir: cannot create directory `//var/www': File exists cp: target `//var/www/localhost' is not a directory chown: cannot access `//var/www/localhost': No such file or directory >>> www-servers/apache-2.0.58-r2 merged. For the certificate, maybe there's some reason it can't be generated prior to installation (umm), but I'd say that belongs more in an ebuild config command. As for installing files into /var/www, why this happens AFTER install time is beyond me. It seems that everything should go into the sandbox, and then be merged.
For the certificates, see Bug 174759. The rest is heavily commented in the ebuild, so read the ebuild for reasons. Nothing to be done here, sorry; If you dislike the ebuild, you'll have to maintain your own in your overlay.