install Apache1 and Apache2 on the same server

Wayne Sierke ws at au.dyndns.ws
Sat Jul 16 15:29:15 GMT 2005


On Sat, 2005-07-16 at 01:51 +0200, Ksenia Marasanova wrote:
> Greetings,
> 
> I have FreeBSD box that runs Apache1 from ports. Now I'd like to
> install Apache2 from ports (and run it on different IP), without
> overwriting httpd binary of Apache1. What would be the correct,
> port-friendly :) way to do it? (I also use portupgrade, it would be
> nice if portupgrade will still be able to upgrade both ports)
> 
> Any tips or pointers to man pages are appreciated.
> 
> Thanks!
> 
I went through this recently, installing www/apache13-modssl on a box
that already had www/apache21 installed. So rest assured it can be done
(since I managed to do it, it can't be too hard!). Unfortunately I
didn't take notes as I should have and despite making a mental note to
avoid doing so I managed to blow away my modified files by cvsup-ing
ports on that box. (Would appreciate tips on how to avoid/work around
this?)

Between the two ports the bulk of the files go to unique destinations,
the exceptions include 1) the bin/sbin binaries, 2) the
installed/default pages and 3) man pages and IIRC the port refused to
install until the conflicts were resolved. The key to this is the line
in the Makefile that adds "--with-layout=FreeBSD" to CONFIGURE_ARGS (you
can extract and examine the file "config.layout" from the source tarball
to see the resulting layout scheme). Unfortunately setting PREFIX isn't
sufficient to resolve it and I ended up replacing the "--with-layout"
line in the Makefile with an alternate layout spec, something like:

--prefix=${PREFIX} \
--exec_prefix=${PREFIX}/apache \
--bindir=${PREFIX}/apache/bin \
--sbindir=${PREFIX}/apache/sbin \
--libexecdir=${PREFIX}/libexec/apache \
--mandir=${PREFIX}/apache/man \
--sysconfdir=${PREFIX}/etc/apache \
--datadir=${PREFIX}/apache/www \
--iconsdir=${PREFIX}/apache/www/icons \
--htdocsdir=${PREFIX}/apache/www/data \
--manualdir=${PREFIX}/share/doc/apache \
--cgidir=${PREFIX}/apache/www/cgi-bin \
--includedir=${PREFIX}/include/apache \
--localstatedir=/var \
--runtimedir=/var/run/apache \
--logfiledir=/var/log \
--proxycachedir=${PREFIX}/www/proxy

Read the Apache docs and you'll see that you should also be able to
create your own custom layout config either by modifying config.layout
or just creating your own custom layout file, and changing the
--with-layout line in the Makefile appropriately (this might be a
candidate to have the FreeBSD Apache ports updated - to allow custom
layouts to be specified). Note that when installing dependent ports
you'll need to set APXS according to which apache install is relevant
(e.g. in my case I need it to reference /usr/local/apache/bin/apxs when
installing against 1.3.x, rather than the default
2.x /usr/local/sbin/apxs).

I don't know how you'll go customising this for Apache2.x, however
having done it for 1.3.x I can relate that I ran in to problems
installing some subsequent dependent ports (some of the p5-* ports and
the bricolage port). From what I can recall it was to do with failing to
honour the APXS variable and some hard-wired assumptions about apache
files being installed at a prefix of /usr/local. I think there were
issue with port removal, too. In any case don't be surprised if you find
yourself having to do further customisation when installing ports
dependent on your customised apache.

Finally, as you've noted, to be able to run both versions side-by-side
you'll need to have your apaches configured appropriately, different IPs
or ports, etc. I currently have them both running on the same IP address
on different ports. Bricolage and Apaches are all doing fine.

If anyone has any hints/references as to how best to manage these kinds
of customisations to ports, it would be greatly appreciated.


HTH,

Wayne




More information about the freebsd-questions mailing list