Multiple instances of Apache

David Jenkins david.jenkins at
Thu Nov 11 23:48:56 GMT 2004

On Thu, 11 Nov 2004 22:45:20 +0000, Lee Brotherston <lee at> wrote:
> David Jenkins wrote:
> > Within there, I would like all of apache, PHP5 and it's dependencies.
> You can do that with ports.  The main problems you would encounter are:
> - As you will have to set the dirs with environment variables,
> portupgrade would only upgrade one of the apaches automatically so you'd
> need to do one manually (I think anyway)
> - The ports database will already see the first apache as being
> installed, so you'd have to force package register the second one.
> > If that's not too good an idea - perhaps because I would need 2
> > versions of many ports installed and using portupgrade would be
> > slightly complicated, then perhaps I should just forget the ports tree
> > and just
> >
> > ./configure --prefix=/jail --other-things=/usr/local
> >
> > etc ... from source?
> If you set --prefix=/some/path then you will get the whole apache
> install (binaries, config, man pages and all) installed from that path
> down.  So ./configure'ing twice with two different paths would give you
> two apaches in different dirs.  Each would have their own apachectl
> which would make it easy to stop and start (I did this when running both
> apache1 and apache2 at one point).
> If you wanted the single apache, two configs option.  It's just the
> standard install and copy the configuration to a second place.  Pitfalls
> with this would be:
> - Needing to set a seperate location for things like pid files
> - apachectl by default will only start one instance, you'd need to
> fiddle with that or start apache by calling httpd directly.

Firstly, thanks all for you help and advice.
Secondly, in case this helps someone else out, here's what I did.

cd /usr/ports/www/apache13
make PREFIX=/jail FORCE_PKG_REGISTER="yes" install

cd /usr/ports/lang/php5
make PREFIX=/jail install

vi /jail/sbin/apachectl
# to change the path to the pid, so it's different from the standard
apache install
vi /jail/etc/apache/httpd.conf
# to change the port to 81 etc ...

I then stopped my standard apache and tried starting the new apache
with PHP5 support
It started.

But even though I had changed the following in /jail/sbin/apachectl from:




It is still writing the pid to /var/run/ when I start this new apache.

When I then try stopping it with apachectl I get this

# /jail/sbin/apachectl stop
# /jail/sbin/apachectl stop: httpd (no pid file) not running

i.e. it's looking in /jail/var/run/ which I defined in the apachectl
script, but the pid for some strange reason is still in /var/run/

Also, if I start my original apache - which puts the pid in /var/run,
then I start my new apache, both work fine, except the new apache
overwrites the originals' pid file ....

What have I done wrong?


More information about the Ukfreebsd mailing list