VirtualHost handling in apache2 Port

Rainer Müller raimue at macports.org
Thu Mar 25 12:32:56 PDT 2010


On 2010-03-25 16:44 , Rodney Rehm / Medialize.de wrote:
> It would be nice if `port install phpmyadmin +apache2vhost` would
> 1) add a dependency to apache2
> 2) create a vhost for phpmyadmin using a (pre-configured) domain scheme (e.g. "${portname}.dev" or "${portname}.localhost")
> 3) register "${portname}.dev" for localhost in /etc/hosts

MacPorts should not touch /etc/hosts at all.

> The apache2 port would have to be extended by a vhosts variant, that
would create ${prefix}/apache2/vhosts and patch httpd.conf to use vhosts
and include them from ${prefix}/apache2/vhosts/*.conf - then all other
Ports would have a central space for putting their virtual hosts. If
you're concerned about security, you can have the ports create their
vhosts disabled by default (*.conf.disabled).

Debian has the concept of using two configuration directories for
vhosts: /etc/apache2/sites-available/ and /etc/apache2/sites-enabled/.
The latter contains symlinks to the config files in the former. There
are also scripts (a2ensite, a2dissite) to do this automatically.

I am now ignoring the fact that apache2 is using a weird layout... :-)

If we had a similar directory structure in ${prefix}/etc the mentioned
ports could provide an example vhost config file which can be copied
into this place (or probably sites-available/${portname}.conf.example).
Users should still be able to modify the vhost configuration to match on
a different ServerName or set different options which is why I would go
for examples only until we have real merge handling of config files.

Rainer


More information about the macports-dev mailing list